This Rmarkdown file shows the code we used to analyze demographic change over time in and outside of historic districts.

knitr::opts_chunk$set(echo = TRUE, message=F, warning=F, fig.width = 11.5, fig.height = 6.5)
library(readr)
library(sf)
## Linking to GEOS 3.13.1, GDAL 3.11.0, PROJ 9.6.0; sf_use_s2() is TRUE
library(leaflet)
library(rstudioapi)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(ggplot2)
library(patchwork)
library(plotly)
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
library(did)

Set working directory to the place this script is saved:

# Getting the path of your current open file
current_path = rstudioapi::getActiveDocumentContext()$path 
setwd(dirname(current_path))

Load and clean data

Load our data. We’ll first do the analysis using Census tracts, and then later use Census blocks.

# load data that has the dates the historic districts were designated
# comes from here: https://planning.dc.gov/page/dc-historic-districts
# hd_data <- readr::read_csv("https://docs.google.com/spreadsheets/d/1Ajl1iAS0NRB7vk_UFDveeWzGkwf3tuiDo-zV9_wtzRM/gviz/tq?tqx=out:csv&sheet=data")
hd_data <- readr::read_csv("hd_data/data.csv")

# load the historic district boundary shape files
# comes from here: https://opendata.dc.gov/datasets/DCGIS::historic-districts/about 
hd_shp <- sf::st_read("Historic_Districts/Historic_Districts.shp")
## Reading layer `Historic_Districts' from data source 
##   `C:\Users\edwar\Documents\GitHub\hd_analysis\Historic_Districts\Historic_Districts.shp' 
##   using driver `ESRI Shapefile'
## Simple feature collection with 73 features and 18 fields
## Geometry type: MULTIPOLYGON
## Dimension:     XY
## Bounding box:  xmin: -8584936 ymin: 4696608 xmax: -8564736 ymax: 4720410
## Projected CRS: WGS 84 / Pseudo-Mercator
# load the 2022 ward shape files
# comes from here: https://opendata.dc.gov/datasets/DCGIS::wards-from-2022/about
ward_shp <- sf::st_read("Wards_from_2022/Wards_from_2022.shp")
## Reading layer `Wards_from_2022' from data source 
##   `C:\Users\edwar\Documents\GitHub\hd_analysis\Wards_from_2022\Wards_from_2022.shp' 
##   using driver `ESRI Shapefile'
## Simple feature collection with 8 features and 20 fields
## Geometry type: POLYGON
## Dimension:     XY
## Bounding box:  xmin: -8584936 ymin: 4691870 xmax: -8561487 ymax: 4721094
## Projected CRS: WGS 84 / Pseudo-Mercator
# load the zoning map:
# comes from here: https://opendata.dc.gov/datasets/DCGIS::zoning-boundaries-zoning-regulations-of-2016/about
zone_shp <- sf::st_read("zoning/Zoning_Boundaries_(Zoning_Regulations_of_2016).shp")
## Reading layer `Zoning_Boundaries_(Zoning_Regulations_of_2016)' from data source 
##   `C:\Users\edwar\Documents\GitHub\hd_analysis\zoning\Zoning_Boundaries_(Zoning_Regulations_of_2016).shp' 
##   using driver `ESRI Shapefile'
## Simple feature collection with 953 features and 15 fields
## Geometry type: MULTIPOLYGON
## Dimension:     XY
## Bounding box:  xmin: -8584936 ymin: 4691870 xmax: -8561487 ymax: 4721094
## Projected CRS: WGS 84 / Pseudo-Mercator
# load & clean census tract data
# please see https://opendata.dc.gov/datasets/DCGIS::census-tracts-in-1970/about
# for example, for more details on variable names
load_clean_tracts <- function(geo_id_var, black_var, white_var, totpop_var, year) {
  # Loads the shapefile, removes unneeded columns, calculates the tract area in meters^2
  shp <- sf::st_read(paste0("tract_data/Census_Tracts_in_", year, 
                            "/Census_Tracts_in_", year, ".shp")) 
  shp <- shp %>% 
    rename("geo_id" = !!sym(geo_id_var),
           "n_black" = !!sym(black_var),
           "n_white" = !!sym(white_var),
           "n_tot" = !!sym(totpop_var)
           ) %>%
    select("geo_id", starts_with("n_")) %>%
    mutate(n_other = n_tot - (n_black + n_white),
           year = year)
  shp$geo_area_meters <- sf::st_area(shp)
  shp <- sf::st_transform(shp, 4326)
  
  return(shp %>% select("year", "geo_id", "n_tot", "n_black", "n_white", "n_other", "geo_area_meters", "geometry"))
}


clean_block_data <- function(shp, df, shp_b_id, df_b_id, var_prefix, df_n_black, df_n_white, drop_var="", year) {
  shp <- shp %>% select(!!sym(shp_b_id)) %>% rename("geo_id" = !!sym(shp_b_id))
  if (drop_var!="") {df <- df %>% select(-!!sym(drop_var))}
  df <- df %>% 
    select(!!sym(df_b_id), starts_with(var_prefix)) %>%
    rowwise() %>%
    mutate(n_tot = sum(c_across(starts_with(var_prefix))))
    
  df <- df %>%
    rename("geo_id" = !!sym(df_b_id),
           "n_black" = !!sym(df_n_black),
           "n_white" = !!sym(df_n_white)) %>%
    select(-starts_with(var_prefix)) %>%
    mutate(n_other = n_tot - (n_black + n_white))
  
  shp <- dplyr::left_join(shp, df, by="geo_id")
  shp <- sf::st_transform(shp, 4326)
  shp$geo_area_meters <- sf::st_area(shp)
  shp$year <- year
  
  return(shp)
}


# Load raw block data:
  
# b70_shp <- sf::st_read("block_shapes/US_block_1970/US_block_1970.shp")
# b70_shp <- b70_shp[b70_shp$STATE70=="11",]
# sf::st_write(b70_shp, "block_shapes/DC_block_1970/DC_block_1970.shp")

b70_shp <- sf::st_read("block_shapes/DC_block_1970/DC_block_1970.shp")
## Reading layer `DC_block_1970' from data source 
##   `C:\Users\edwar\Documents\GitHub\hd_analysis\block_shapes\DC_block_1970\DC_block_1970.shp' 
##   using driver `ESRI Shapefile'
## Simple feature collection with 4665 features and 6 fields
## Geometry type: MULTIPOLYGON
## Dimension:     XY
## Bounding box:  xmin: 1610795 ymin: 308338.5 xmax: 1629412 ymax: 329313.2
## Projected CRS: USA_Contiguous_Albers_Equal_Area_Conic
b80_shp <- sf::st_read("block_shapes/DC_block_1980/DC_block_1980.shp")
## Reading layer `DC_block_1980' from data source 
##   `C:\Users\edwar\Documents\GitHub\hd_analysis\block_shapes\DC_block_1980\DC_block_1980.shp' 
##   using driver `ESRI Shapefile'
## Simple feature collection with 4627 features and 10 fields
## Geometry type: MULTIPOLYGON
## Dimension:     XY
## Bounding box:  xmin: 1610795 ymin: 308338.5 xmax: 1629412 ymax: 329313.2
## Projected CRS: USA_Contiguous_Albers_Equal_Area_Conic
b90_shp <- sf::st_read("block_shapes/nhgis0092_shapefile_tl2000_110_block_1990/DC_block_1990.shp")
## Reading layer `DC_block_1990' from data source 
##   `C:\Users\edwar\Documents\GitHub\hd_analysis\block_shapes\nhgis0092_shapefile_tl2000_110_block_1990\DC_block_1990.shp' 
##   using driver `ESRI Shapefile'
## Simple feature collection with 5140 features and 5 fields
## Geometry type: MULTIPOLYGON
## Dimension:     XY
## Bounding box:  xmin: 1610795 ymin: 308338.5 xmax: 1629412 ymax: 329313.2
## Projected CRS: USA_Contiguous_Albers_Equal_Area_Conic
b00_shp <- sf::st_read("block_shapes/nhgis0092_shapefile_tl2000_110_block_2000/DC_block_2000.shp")
## Reading layer `DC_block_2000' from data source 
##   `C:\Users\edwar\Documents\GitHub\hd_analysis\block_shapes\nhgis0092_shapefile_tl2000_110_block_2000\DC_block_2000.shp' 
##   using driver `ESRI Shapefile'
## Simple feature collection with 5626 features and 6 fields
## Geometry type: MULTIPOLYGON
## Dimension:     XY
## Bounding box:  xmin: 1610795 ymin: 308338.5 xmax: 1629412 ymax: 329313.2
## Projected CRS: USA_Contiguous_Albers_Equal_Area_Conic
b10_shp <- sf::st_read("block_shapes/nhgis0092_shapefile_tl2010_110_block_2010/DC_block_2010.shp")
## Reading layer `DC_block_2010' from data source 
##   `C:\Users\edwar\Documents\GitHub\hd_analysis\block_shapes\nhgis0092_shapefile_tl2010_110_block_2010\DC_block_2010.shp' 
##   using driver `ESRI Shapefile'
## Simple feature collection with 6426 features and 18 fields
## Geometry type: MULTIPOLYGON
## Dimension:     XY
## Bounding box:  xmin: 1610830 ymin: 308504.6 xmax: 1629412 ymax: 329361
## Projected CRS: USA_Contiguous_Albers_Equal_Area_Conic
b20_shp <- sf::st_read("block_shapes/nhgis0092_shapefile_tl2020_110_block_2020/DC_block_2020.shp")
## Reading layer `DC_block_2020' from data source 
##   `C:\Users\edwar\Documents\GitHub\hd_analysis\block_shapes\nhgis0092_shapefile_tl2020_110_block_2020\DC_block_2020.shp' 
##   using driver `ESRI Shapefile'
## Simple feature collection with 5935 features and 18 fields
## Geometry type: POLYGON
## Dimension:     XY
## Bounding box:  xmin: 1610830 ymin: 308504.6 xmax: 1629412 ymax: 329396
## Projected CRS: USA_Contiguous_Albers_Equal_Area_Conic
b70_df <- readr::read_csv("block_data/nhgis0093_ds96_1970_block.csv")
b80_df <- readr::read_csv("block_data/nhgis_ds104_1980_block_11.csv")
b90_df <- readr::read_csv("block_data/nhgis0092_ds120_1990_block.csv")
b00_df <- readr::read_csv("block_data/nhgis0092_ds147_2000_block.csv")
b10_df <- readr::read_csv("block_data/nhgis0092_ds172_2010_block.csv")
b20_df <- readr::read_csv("block_data/nhgis0092_ds258_2020_block.csv")

# 1970 block data has to be specially cleaned, see https://forum.ipums.org/t/race-ethnicity-data-at-a-block-level-from-1970/6178
b70_df$c_black <- b70_df$CM6001 + b70_df$CM6002
b70_df$c_other <- b70_df$CM6003 + b70_df$CM6004
b70_df$c_white <- b70_df$CM5001 + b70_df$CM5002 - b70_df$c_black - b70_df$c_other

Clean tracts for 1960 and blocks for all later decades:

# turn off spherical geometry (s2)
sf_use_s2(FALSE)

# need to fix broken geometries:
fix_geo_if_broken <- function(shp) {
  if (min(sf::st_is_valid(shp)) == 0) {
    print("Fixing geometry...")
    return(sf::st_make_valid(shp))
  } else {
      return(shp)
    }
  }

zone_shp <- fix_geo_if_broken(zone_shp)
hd_shp <- fix_geo_if_broken(hd_shp)
ward_shp <- fix_geo_if_broken(ward_shp)
b70_shp <- fix_geo_if_broken(b70_shp)
b80_shp <- fix_geo_if_broken(b80_shp)
b90_shp <- fix_geo_if_broken(b90_shp)
b10_shp <- fix_geo_if_broken(b10_shp)
b20_shp <- fix_geo_if_broken(b20_shp)


b60_shp <- load_clean_tracts("GISJOIN", "B58013", "B58011", "CA4001", 1960)
b60_shp <- fix_geo_if_broken(b60_shp)
# in an older version of this analysis, I ran everything using tracts;
# you can uncomment the lines below to load the tract data and do that
# b70_shp <- load_clean_tracts("GISJOIN", "CEB03", "CEB01", "CY7001", 1970) 
# b80_shp <- load_clean_tracts("GISJOIN", "C9D003", "C9D001", "C7L001", 1980)
# b90_shp <- load_clean_tracts("TRACTNO", "BLACK", "WHITE", "POPULATION", 1990)
# b00_shp <- load_clean_tracts("TRACTNO", "BLACK", "WHITE", "TOTAL", 2000)
# b10_shp <- load_clean_tracts("TRACT", "P0010004", "P0010003", "P0010001", 2010)
# b20_shp <- load_clean_tracts("TRACT", "P0010004", "P0010003", "P0010001", 2020)
gc()

b70_shp <- clean_block_data(b70_shp, b70_df, "GISJOIN", "GISJOIN", "c_", "c_black", "c_white", year=1970)
b80_shp <- clean_block_data(b80_shp, b80_df, "GISJOIN", "GISJOIN", "C9D0", "C9D002", "C9D001", year=1980)
b90_shp <- clean_block_data(b90_shp, b90_df, "GISJOIN", "GISJOIN", "EUY0", "EUY002", "EUY001", year=1990)
b00_shp <- clean_block_data(b00_shp, b00_df, "GISJOIN", "GISJOIN", "FYE0", "FYE002", "FYE001", year=2000)
b10_shp <- clean_block_data(b10_shp, b10_df, "GISJOIN", "GISJOIN", "H7X", "H7X003", "H7X002", "H7X001", year=2010)
b20_shp <- clean_block_data(b20_shp, b20_df, "GISJOIN", "GISJOIN", "U7J", "U7J003", "U7J002", "U7J001", year=2020)

rm(b70_df, b80_df, b90_df, b00_df, b10_df, b20_df)

gc()

Merge historic district (HD) data onto HD shapefile, subset to only look at neighborhood HDs:

hd_shp <- dplyr::left_join(x = hd_shp, y = hd_data, by = "UNIQUEID")
hd_shp <- hd_shp[hd_shp$Neighborhood_HD==1,]

Transform shape files to mercator projection:

# convert to mercator projection
zone_shp <- sf::st_transform(zone_shp, 4326)
hd_shp <- sf::st_transform(hd_shp, 4326)
ward_shp <- sf::st_transform(ward_shp, 4326)

Initial descriptive statistics

Let’s overlay HDs onto DC’s zoning map.

# list zones:
zones_list <- sort(unique(zone_shp$ZR16))
housing_zones <- zones_list[grep(x=zones_list, pattern = "^R|^MU")]
# subset
zone_shp <- zone_shp[zone_shp$ZR16 %in% housing_zones,]

# create simplified labels
zone_shp$ZR16_simple <- "Other"
zone_shp$ZR16_simple[grep(x=zone_shp$ZR16, pattern="^RA-")] <- "Apartment zones"
zone_shp$ZR16_simple[grep(x=zone_shp$ZR16, pattern="^R-")] <- "Residential zones"
zone_shp$ZR16_simple[grep(x=zone_shp$ZR16, pattern="^RF-")] <- "Residential flat zones"
zone_shp$ZR16_simple[grep(x=zone_shp$ZR16, pattern="^MU-")] <- "Mixed use zones"

# show on a map:
factpal <- colorFactor(palette = "Set1", domain = zone_shp$ZR16_simple)

leaflet(zone_shp) %>%
  addProviderTiles(providers$CartoDB.Positron) %>%
  addPolygons(fillColor = ~factpal(ZR16_simple), # Apply the color function
              fillOpacity = 0.7,
              weight = 1,
              opacity = 1,
              color = "white",
              label=~ZR16,
              highlightOptions = highlightOptions(weight = 3,
                                                  color = "white",
                                                  bringToFront = TRUE
        )
  ) %>%
  addLegend(pal = factpal, values = ~ZR16_simple, opacity = 0.7, title = NULL,
    position = "bottomright")

Calculate the total amount of residential and MU land in DC:

zone_shp$area_meters <- sf::st_area(zone_shp)
zone_shp$area_acres <- as.vector(zone_shp$area_meters * 0.000247105)
total_zone_acres <- sum(zone_shp$area_acres, na.rm=T)

Total and % of land area covered by HDs over time:

# get shape areas:
hd_shp$area_meters <- sf::st_area(hd_shp)
hd_shp$area_acres <- as.vector(hd_shp$area_meters * 0.000247105)

years <- c(1960, 1970, 1980, 1990, 2000, 2010, 2025)
land_areas <- rep(NA, length(years))
counter <- 1
for (year in years) { # Land area covered by HDs by year:
  land_area <- sum(hd_shp$area_acres[hd_shp$desig_date < year])
  land_areas[counter] <- land_area
  counter <- counter + 1
}

p <- data.frame(years, land_areas, round(100*land_areas / total_zone_acres,0))
names(p) <- c("Year", 
              "Area covered by by Historic Districts, in Acres",
              "Percent of 2016 residential zone covered by Neighborhood HD")
plot1 <-
  ggplot(p, 
       aes(x=Year, 
           y=`Area covered by by Historic Districts, in Acres`)) + 
  geom_bar(stat = "identity", fill="#0f9535") +
  geom_text(aes(label = round(`Area covered by by Historic Districts, in Acres`, 0), vjust = -1.7)) +
  ylab("Acres") +
  theme_minimal() +
  ggtitle('Acres covered by "neighborhood historic districts"\nhas steadily increased over time')

plot2 <-
  ggplot(p, 
       aes(x=Year, 
           y=`Percent of 2016 residential zone covered by Neighborhood HD`)) + 
  geom_line(color="#0f9535", size=.75) +
  geom_point(color="#0f9535") +
  geom_text(aes(label = paste0(`Percent of 2016 residential zone covered by Neighborhood HD`, "%")), vjust = -1.7) +
  theme_minimal() +
  ylab("Percent") +
  ggtitle('And the % of residential area covered\nby HDs has more than doubled since 1980')

plot1 + plot2

Let’s quickly compare which HDs were designated before vs after 1980:

hd_shp$flag_1980 <- 0
hd_shp$flag_1980[hd_shp$desig_date < 1980] <- 1

leaflet() %>%
  addProviderTiles(providers$CartoDB.Positron) %>%
  addPolygons(group= "Designated before 1980",
              data=hd_shp[hd_shp$flag_1980==1,],
              fillColor = "skyblue", 
              fillOpacity = 0.7,
              weight = 1,
              opacity = 1,
              color = "white",
              label=~LABEL,
              highlightOptions = highlightOptions(weight = 3,
                                                  color = "white",
                                                  bringToFront = FALSE
        ) 
  ) %>%
  addPolygons(group= "Designated after 1980",
              data=hd_shp[hd_shp$flag_1980==0,],
              fillColor = "hotpink", 
              fillOpacity = 0.7,
              weight = 1,
              opacity = 1,
              color = "white",
              label=~LABEL,
              highlightOptions = highlightOptions(weight = 3,
                                                  color = "white",
                                                  bringToFront = FALSE
        ) 
  ) %>%
  addLayersControl(
    overlayGroups = c("Designated before 1980", "Designated after 1980"),
    options = layersControlOptions(collapsed = FALSE)
  )

We’ll remove some very small HDs for the next part (like HDs that are a single circle):

# Drop some very small HDs that are like a single circle
# We just dropped anything smaller than 10 acres
hd_shp <-
  hd_shp %>%
  filter(!(LABEL %in% c("Emerald St HD",
                       "Grant Rd HD",
                       "Mount Vernon Triangle HD",
                       "Grant Circle HD",
                       "Union Market"
                       )))

Demographic change analysis

Now let’s look and see how HDs changed over time, in terms of % black residents and % white residents, compared to nearby neighborhoods (groups of blocks) that were not in HDs.

This will have a few steps:

  1. Take a given HD.
  2. Get the intersection of the HD with census tracts (in 1960) and blocks (in 1970 to 2020). If at least X% of the census tract area is in the HD, we’ll count it as part of the HD.
  3. Create a buffer around the HD of distance Y. Run another intersection with the census tracts/blocks and that buffer. Count any tracts/blocks that touch the buffer but are not in an HD as comparison tracts.
  4. Note the % of white and black residents in each HD and those HDs comparison tracts/blocks.
  5. See how those respective percentages change over time.

Function to find which tracts/blocks are in which HDs:

get_geos_in_hd <- function(shp, min_pct, year) {
  # This function gets the tracts that are in each HD in a given year
  # shp: the tract or block shapefile (an sf shapefile object)
  # min_pct: the minimum % of the tract or block that must be in the HD to count as part of the HD (a decimal # between 0 and 1)
  # year: the year (an integer like 1980)
  i <- sf::st_intersection(x=shp, y=hd_shp)
  i$i_area <- sf::st_area(i)
  i$pct_of_geo_area <- as.vector(i$i_area / i$geo_area_meters)
  
  geos_in_hd <- i[i$pct_of_geo_area > min_pct, 
                    c("year", "geo_id", "LABEL",
                      "n_tot", "n_black", "n_white", "n_other",
                      "desig_date", "pct_of_geo_area")]
  
  geos_in_hd$geo_area <- sf::st_area(geos_in_hd)
  
  geos_in_hd_summary <-
    geos_in_hd %>%
    mutate(n_tot_prorated = n_tot * pct_of_geo_area,
           n_black_prorated = n_black * pct_of_geo_area,
           n_white_prorated = n_white * pct_of_geo_area,
           n_other_prorated = n_other * pct_of_geo_area) %>%
    select("year", "LABEL", "geo_id", starts_with("n_"), "desig_date", "geo_area") %>%
    group_by(LABEL) %>%
      summarise(n_tot = sum(n_tot, na.rm=T),
                n_black = sum(n_black, na.rm=T),
                n_white = sum(n_white, na.rm=T),
                n_other = sum(n_other, na.rm=T),
                n_tot_prorated = sum(n_tot_prorated, na.rm=T),
                n_black_prorated = sum(n_black_prorated, na.rm=T),
                n_white_prorated = sum(n_white_prorated, na.rm=T),
                n_other_prorated = sum(n_other_prorated, na.rm=T),
                desig_year = max(desig_date, na.rm=T),
                geo_area = sum(geo_area, na.rm=T)) %>%
    mutate(desig_yet = ifelse(desig_year<year, 1, 0), 
           year = year,
           pop_dens = n_tot / geo_area)
  
    rv = list("geos_in_hd"=geos_in_hd, "summary"=sf::st_drop_geometry(geos_in_hd_summary))
    
    return(rv)
}

Function to find which tracts/blocks are nearby but not inside the HDs:

#' Get neighboring geographic units (tracts/blocks) around Historic Districts (HDs)
#'
#' This function identifies geographic units that are adjacent to Historic Districts
#' by creating buffers around HDs and finding intersecting geographic units, while
#' excluding units already classified as within HDs and those where HDs occupy
#' a large portion of the geographic unit.
#'
#' @param hd_shp sf object containing Historic District boundaries
#' @param geo_shp sf object containing geographic units (census tracts/blocks)
#' @param buffer_dist numeric buffer distance (in same units as CRS) around HDs
#' @param geos_in_hd list containing geographic units already within HDs
#' @param remove_geo_thresh numeric threshold (0-1) for removing geos with large HD overlap
#' @param year numeric year for designation comparison
#'
#' @return list with three elements: buffers, neighbor_geos, neighbor_geos_summary
#' 
get_neighbor_geos <- function(hd_shp, geo_shp, buffer_dist, geos_in_hd, remove_geo_thresh, year) {
  # STEP 1: Create buffer zones around Historic Districts
  # Creates a buffer of specified distance around each HD boundary
  # This defines the "neighborhood" area we're interested in
  b <- sf::st_buffer(hd_shp, dist = buffer_dist)
  # STEP 2: Find geographic units that intersect with HD buffers
  # This identifies all census tracts/blocks that fall within or overlap
  # the buffer zones around Historic Districts
  i <- sf::st_intersection(x=geo_shp, y=b)
  # STEP 3: Remove geographic units already classified as within an HD
  # Excludes any tracts/blocks that have already been identified as being
  # inside Historic District boundaries (not just neighboring them)
  i <- i[!(i$geo_id %in% geos_in_hd$geos_in_hd$geo_id),]
  # STEP 4: Calculate HD area coverage within each geographic unit
  # This section removes geographic units where Historic Districts occupy
  # more than the specified threshold percentage of the unit's area
  
  # Calculate total area of each Historic District
  hd_shp$area_meters <- sf::st_area(hd_shp)
  # Find intersection between all geographic units and Historic Districts
  # This shows where HDs actually overlap with census tracts/blocks
  hd_geo <- sf::st_intersection(x=geo_shp, y=hd_shp)
  # Calculate the area of HD-geography intersection
  hd_geo$intersect_area <- sf::st_area(hd_geo)
  # Calculate what percentage of each HD falls within each geographic unit
  # This helps identify cases where most of an HD is contained within a single tract/block
  hd_geo$pct_area <- as.vector(hd_geo$intersect_area / hd_geo$area_meters)
  # Identify geographic units to remove (those with HD coverage above threshold)
  # These are units where Historic Districts occupy too large a portion to be
  # considered merely "neighboring" - they likely contain significant HD area
  geos_to_remove <- hd_geo$geo_id[hd_geo$pct_area > remove_geo_thresh]
  # Remove the problematic geographic units from our neighboring list
  neighboring_geos <- i[!(i$geo_id %in% geos_to_remove),]
  
  # STEP 5: Create final neighboring geographic units dataset
  # Get the full geographic data for the identified neighboring units
  neighboring_geos <- geo_shp[geo_shp$geo_id %in% neighboring_geos$geo_id,]
  # Add HD information (label and designation date) to neighboring geographic units
  # This links each neighboring unit to its associated Historic District(s)
  neighboring_geos <- dplyr::left_join(neighboring_geos, 
                                         sf::st_drop_geometry(i[,c("geo_id", "LABEL", "desig_date")]),
                                         by="geo_id")
  
  # STEP 6: Add area variable:
  neighboring_geos$geo_area <- sf::st_area(neighboring_geos)
  
  # STEP 7: Create summary statistics by Historic District
  # Aggregate demographic data across all neighboring units for each HD
  neighbor_geos_summary <-
    sf::st_drop_geometry(neighboring_geos) %>%
    group_by(LABEL) %>%
      summarise(n_tot = sum(n_tot, na.rm=T),
                n_black = sum(n_black, na.rm=T),
                n_white = sum(n_white, na.rm=T),
                n_other = sum(n_other, na.rm=T),
                desig_year = max(desig_date, na.rm=T),
                tot_area = sum(geo_area, na.rm=T)) %>%
    mutate(desig_yet = ifelse(desig_year<year, 1, 0),
           year = year,
           pop_dens = n_tot / tot_area)
  
  # STEP 8: Return comprehensive results
  rv = list("buffers" = b, 
            "neighbor_geos" = neighboring_geos, 
            "neighbor_geos_summary" = neighbor_geos_summary)
  
  return(rv)
}

Function to map those tracts/blocks and see if everything looks good:

plot_geos <- function(geo_shp, nearby_geos_shp, geos_in_hds) {
  rv <-
    leaflet() %>%
  addProviderTiles(providers$CartoDB.Positron) %>%
  addPolygons(group='buffers', data=nearby_geos_shp[["buffers"]]) %>%
  addPolygons(group= "geos labeled as near HDs",
              data=nearby_geos_shp[["neighbor_geos"]],
              fillColor = "skyblue", 
              fillOpacity = 0.7,
              weight = 1,
              opacity = 1,
              color = "white",
              label=~paste0("Geo: ", geo_id, "; HD neighbor: ", LABEL),
              highlightOptions = highlightOptions(weight = 3,
                                                  color = "white",
                                                  bringToFront = FALSE
        ) 
  ) %>%
    addPolygons(group= "geos labeled as in HDs",
              data=geo_shp[geo_shp$geo_id %in% geos_in_hds, ],
              fillColor = "limegreen", 
              fillOpacity = 0.7,
              weight = 1,
              opacity = 1,
              color = "white",
              label=~geo_id,
              highlightOptions = highlightOptions(weight = 3,
                                                  color = "white",
                                                  bringToFront = FALSE
        ) 
  ) %>%
  addPolygons(group= "HDs",
              data=hd_shp,
              fillColor = "hotpink", 
              fillOpacity = 0.7,
              weight = 1,
              opacity = 1,
              color = "white",
              label=~LABEL,
              highlightOptions = highlightOptions(weight = 3,
                                                  color = "white",
                                                  bringToFront = FALSE
        ) 
  ) %>%
  addLayersControl(
    overlayGroups = c("geos labeled as near HDs", "geos labeled as in HDs", "HDs", "buffers"),
    options = layersControlOptions(collapsed = FALSE)
  )
  
  return(rv)
}

make_lineplot <- function(depend_var, group, title, df) {
  rv <-
    ggplot(df[df$group==group,], 
           aes(x=year, y=!!sym(depend_var), color=treatment_control)) + 
  geom_point() + 
  geom_line() +
  geom_vline(data = df[df$group==group,],
             aes(xintercept = first_decade_desig_copy), 
             color = group, 
             linetype = "dashed", 
             size = 1) +
  ggtitle(title) +
    facet_grid(rows = vars(LABEL), scales = "free_y")
  
  return(rv)
}

Function to run regressions:

run_regressions <- function(hd_comp_df, near_comp_df, dep_var) {
  
  near_comp_df$LABEL <- gsub(x = near_comp_df$LABEL, pattern = " HD", replacement = "")
  hd_comp_df$LABEL <- gsub(x = hd_comp_df$LABEL, pattern = " HD", replacement = "")
  
  hd_comp_df <-
    hd_comp_df %>%
    select(-ends_with("_prorated"), -desig_year) %>%
    group_by(LABEL, desig_yet, year) %>%
    summarise_all(., sum) %>%
    mutate(pct_black = n_black / n_tot,
           pct_white = n_white / n_tot) %>%
    rename_with(~ paste0(., "_hd"))
  
  near_comp_df <-
    near_comp_df %>%
    select(-desig_year) %>%
    group_by(LABEL, desig_yet, year) %>%
    mutate(pct_black = n_black / n_tot,
           pct_white = n_white / n_tot) %>%
    summarise_all(., sum) %>%
    rename_with(~ paste0(., "_near"))
  
  
  comp_df <- dplyr::full_join(x = hd_comp_df, 
                              y = near_comp_df, 
                              by = c("LABEL_hd"="LABEL_near", 
                                     "desig_yet_hd"="desig_yet_near",
                                     "year_hd"="year_near")) 
  
  comp_df_copy <- comp_df
  comp_df <- comp_df %>% select(starts_with(c("LABEL", "desig_yet", "year", "pct_")))
  
  comp_df <-
    comp_df %>%
    tidyr::pivot_longer(
      cols = starts_with("pct_"),
      names_to = c("group", "treatment_control"),
      names_pattern = "pct_([a-zA-Z]+)_([a-zA-Z]+)",
      values_to = "percent")
  
  comp_df <- dplyr::left_join(x = comp_df, 
                              y = comp_df_copy %>% select("LABEL_hd", "desig_yet_hd", "year_hd", 
                                                          "n_tot_hd", "pop_dens_hd", "pop_dens_near"), 
                              by = c("LABEL_hd", 
                                     "desig_yet_hd",
                                     "year_hd")) %>%
    rename(LABEL = "LABEL_hd",
           desig_yet = "desig_yet_hd",
           year = "year_hd")
  
  # remove HDs that are always HDs or always not HDs during the timeframe
  comp_df <-
    comp_df %>%
    group_by(LABEL) %>%
    mutate(mean_status = mean(desig_yet, na.rm=T)) %>%
    filter(mean_status > 0) %>%
    filter(mean_status < 1)
  
  comp_df$treatment_group <- 0
  comp_df$treatment_group[comp_df$treatment_control=="hd"] <- 1 
  
  comp_df$unit_id <- paste(comp_df$LABEL, comp_df$treatment_control, sep = " ")
  
  # add back total population values
  names(hd_comp_df) <- gsub(x = names(hd_comp_df), pattern = "_hd", replacement = "")
  names(near_comp_df) <- gsub(x = names(near_comp_df), pattern = "_near", replacement = "")
  hd_comp_df$pop_in_unit <- hd_comp_df$n_tot
  near_comp_df$pop_in_unit <- near_comp_df$n_tot
  hd_comp_df$treatment_control <- "hd"
  near_comp_df$treatment_control <- "near"
  
  to_add <-
    dplyr::bind_rows(
      hd_comp_df %>% ungroup() %>% select(LABEL, year, treatment_control, pop_in_unit),
      near_comp_df %>% ungroup() %>% select(LABEL, year, treatment_control, pop_in_unit)
    )
  
  comp_df <- dplyr::left_join(x = comp_df, 
                              y = to_add,
                              by = c("LABEL", "year", "treatment_control"))
  
  comp_df$pop_dens <- ifelse(comp_df$treatment_control=="near", comp_df$pop_dens_near, comp_df$pop_dens_hd)
  comp_df <- comp_df %>% select(-pop_dens_hd, -pop_dens_near)
  
  comp_df$unit_id  <- as.factor(comp_df$unit_id)
  comp_df$LABEL    <- as.factor(comp_df$LABEL)
  comp_df$year     <- as.factor(comp_df$year)
  
  for (grp in c("black", "white")) {
    comp_df_subset <- comp_df[comp_df$group==grp,]
    for (w in c("1", "n_tot_hd")) {
      if (w == "1") {wt=rep(1, nrow(comp_df_subset))} else {wt=comp_df_subset$n_tot_hd}
      # diff in diff analysis for change in the % of residents
      main_formula <- as.formula(paste0(dep_var, 
                                        " ~ treatment_group + desig_yet + treatment_group:desig_yet + unit_id + year"))
      
      w_label_formula <- update(main_formula, . ~ . + LABEL)
      
      diff_in_diff <- lm(main_formula, data = comp_df_subset, weights=wt)
      dind_w_label <- lm(w_label_formula, data = comp_df_subset, weights=wt)
      
      print("_______________________________________________________")
      print(paste0("D-in-D regression for the % of ", grp, " residents, ",
                   ifelse(w=="1", "unweighted", "using population weights")))
      print(summary(diff_in_diff))
      print("__________")
      print("Coef. on treatment variable when we add area fixed effects:")
      print(summary(dind_w_label)$coefficients["treatment_group:desig_yet",])
      # plot(diff_in_diff)
      
    }
  }
    
  
  comp_df <-
    comp_df %>%
    group_by(LABEL, desig_yet) %>%
    mutate(first_decade_desig=min(as.numeric(as.character(year)))) %>%
    mutate(first_decade_desig=ifelse(desig_yet==0, 0, first_decade_desig)) %>%
    ungroup() %>%
    group_by(LABEL) %>%
    mutate(first_decade_desig=max(first_decade_desig)) %>%
    mutate(year_index = as.numeric(as.character(year)) - first_decade_desig)
  
  comp_df$first_decade_desig_copy <- comp_df$first_decade_desig
  comp_df$first_decade_desig[comp_df$treatment_control=="near"] <- 0
  comp_df$year     <- as.numeric(as.character((comp_df$year)))
  comp_df <- comp_df %>%
          group_by(unit_id) %>%
          mutate(unit_id_num = cur_group_id())
  
  
  # Alternate specification:
  # https://bcallaway11.github.io/did/articles/did-basics.html#an-example-with-real-data
  # https://cran.r-project.org/web/packages/did/vignettes/pre-testing.html
      hd.attgt <- did::att_gt(yname = dep_var,
                   gname = "first_decade_desig",
                   idname = "unit_id_num",
                   tname = "year",
                   xformla = ~1,
                   data = comp_df[comp_df$group=="black" & !is.na(comp_df$n_tot_hd),],
                   allow_unbalanced_panel = T,
                   weightsname="n_tot_hd"
                   )
      print(summary(hd.attgt))
      group_effects <- aggte(hd.attgt, type = "group", na.rm=T)
      print(summary(group_effects))
    
  return(comp_df)
}

One function to run everything above (we’ll use this for robustness checks):

run_all <- function(mp, buff_dist, threshold, dep_var) {
  hd_geos60 <- get_geos_in_hd(b60_shp, min_pct = mp, year = 1960)
  hd_geos70 <- get_geos_in_hd(b70_shp, min_pct = mp, year = 1970)
  hd_geos80 <- get_geos_in_hd(b80_shp, min_pct = mp, year = 1980)
  hd_geos90 <- get_geos_in_hd(b90_shp, min_pct = mp, year = 1990)
  hd_geos00 <- get_geos_in_hd(b00_shp, min_pct = mp, year = 2000)
  hd_geos10 <- get_geos_in_hd(b10_shp, min_pct = mp, year = 2010)
  hd_geos20 <- get_geos_in_hd(b20_shp, min_pct = mp, year = 2020)
  gc()
  nearby_geos60 <- 
    get_neighbor_geos(hd_shp=hd_shp, geo_shp=b60_shp, buffer_dist=buff_dist, geos_in_hd=hd_geos70,threshold, 1960)
  nearby_geos70 <- 
    get_neighbor_geos(hd_shp=hd_shp, geo_shp=b70_shp, buffer_dist=buff_dist, geos_in_hd=hd_geos70,threshold, 1970)
  nearby_geos80 <- 
    get_neighbor_geos(hd_shp=hd_shp, geo_shp=b80_shp, buffer_dist=buff_dist, geos_in_hd=hd_geos80,threshold, 1980)
  nearby_geos90 <- 
    get_neighbor_geos(hd_shp=hd_shp, geo_shp=b90_shp, buffer_dist=buff_dist, geos_in_hd=hd_geos90,threshold, 1990)
  gc()
  nearby_geos00 <- 
    get_neighbor_geos(hd_shp=hd_shp, geo_shp=b00_shp, buffer_dist=buff_dist, geos_in_hd=hd_geos00,threshold, 2000)
  nearby_geos10 <- 
    get_neighbor_geos(hd_shp=hd_shp, geo_shp=b10_shp, buffer_dist=buff_dist, geos_in_hd=hd_geos10,threshold, 2010)
  nearby_geos20 <- 
    get_neighbor_geos(hd_shp=hd_shp, geo_shp=b20_shp, buffer_dist=buff_dist, geos_in_hd=hd_geos20,threshold, 2020)
  gc()
  
  p60 <- plot_geos(b60_shp, nearby_geos60, hd_geos60$geos_in_hd$geo_id)
  p70 <- plot_geos(b70_shp, nearby_geos70, hd_geos70$geos_in_hd$geo_id)
  p20 <- plot_geos(b20_shp, nearby_geos20, hd_geos20$geos_in_hd$geo_id)
      
  hd_comp_df <- dplyr::bind_rows(hd_geos60[[2]], hd_geos70[[2]], hd_geos80[[2]], hd_geos90[[2]],
                              hd_geos00[[2]], hd_geos10[[2]], hd_geos20[[2]],)
  near_comp_df <- dplyr::bind_rows(nearby_geos60[[3]], nearby_geos70[[3]],nearby_geos80[[3]], nearby_geos90[[3]],
                              nearby_geos00[[3]], nearby_geos10[[3]], nearby_geos20[[3]],)
  
  comp_df <- run_regressions(hd_comp_df, near_comp_df, dep_var)
  
  lineplots = list("black" = NA, "white" = NA, "tot_pop" = NA, "pop_dens" = NA)
  lineplots$black <- make_lineplot(depend_var = "percent", group = "black", title = "Black residents as %", comp_df)
  lineplots$white <- make_lineplot(depend_var = "percent", group = "white", title = "White residents as %", comp_df)
  lineplots$tot_pop <- make_lineplot(depend_var = "pop_in_unit", group = "black", title = "Total population", comp_df)
  lineplots$pop_dens <- make_lineplot(depend_var = "pop_dens", group = "black", title = "Population density", comp_df)
  
  return(list("data" = comp_df, "plot60" = p60, "plot70" = p70, "plot20" = p20,
              "lineplots" = lineplots))
}

Call all the functions we created above for our preferred model specification:

# ranging the min % between .2 and .6 seems to give reasonable results
mp = 0.25 
hd_geos60 <- get_geos_in_hd(b60_shp, min_pct = mp, year = 1960)
hd_geos70 <- get_geos_in_hd(b70_shp, min_pct = mp, year = 1970)
hd_geos80 <- get_geos_in_hd(b80_shp, min_pct = mp, year = 1980)
hd_geos90 <- get_geos_in_hd(b90_shp, min_pct = mp, year = 1990)
hd_geos00 <- get_geos_in_hd(b00_shp, min_pct = mp, year = 2000)
hd_geos10 <- get_geos_in_hd(b10_shp, min_pct = mp, year = 2010)
hd_geos20 <- get_geos_in_hd(b20_shp, min_pct = mp, year = 2020)
gc()
##           used  (Mb) gc trigger  (Mb) max used  (Mb)
## Ncells 3121944 166.8    5132622 274.2  5132622 274.2
## Vcells 8362797  63.9   17564357 134.1 17442382 133.1
# the buffer distance is in decimal degrees
buff_dist = .008
threshold = .1

nearby_geos60 <- 
  get_neighbor_geos(hd_shp=hd_shp, geo_shp=b60_shp, buffer_dist=buff_dist, geos_in_hd=hd_geos70,threshold, 1960)
nearby_geos70 <- 
  get_neighbor_geos(hd_shp=hd_shp, geo_shp=b70_shp, buffer_dist=buff_dist, geos_in_hd=hd_geos70,threshold, 1970)
nearby_geos80 <- 
  get_neighbor_geos(hd_shp=hd_shp, geo_shp=b80_shp, buffer_dist=buff_dist, geos_in_hd=hd_geos80,threshold, 1980)
nearby_geos90 <- 
  get_neighbor_geos(hd_shp=hd_shp, geo_shp=b90_shp, buffer_dist=buff_dist, geos_in_hd=hd_geos90,threshold, 1990)
gc()
##           used  (Mb) gc trigger  (Mb) max used  (Mb)
## Ncells 3123754 166.9    5132622 274.2  5132622 274.2
## Vcells 8559779  65.4   17564357 134.1 17442382 133.1
nearby_geos00 <- 
  get_neighbor_geos(hd_shp=hd_shp, geo_shp=b00_shp, buffer_dist=buff_dist, geos_in_hd=hd_geos00,threshold, 2000)
nearby_geos10 <- 
  get_neighbor_geos(hd_shp=hd_shp, geo_shp=b10_shp, buffer_dist=buff_dist, geos_in_hd=hd_geos10,threshold, 2010)
nearby_geos20 <- 
  get_neighbor_geos(hd_shp=hd_shp, geo_shp=b20_shp, buffer_dist=buff_dist, geos_in_hd=hd_geos20,threshold, 2020)
gc()
##           used  (Mb) gc trigger  (Mb) max used  (Mb)
## Ncells 3124567 166.9    5132622 274.2  5132622 274.2
## Vcells 8764640  66.9   17564357 134.1 17442382 133.1

Plot our classifications in 1960 and 2020, as a gut check:

plot_geos(b60_shp, nearby_geos60, hd_geos60$geos_in_hd$geo_id)
plot_geos(b20_shp, nearby_geos20, hd_geos20$geos_in_hd$geo_id)

Now compare the demographics of the HD tracts and their neighbors in each year:

options(width = 200)

hd_comp_df <- dplyr::bind_rows(hd_geos60[[2]], hd_geos70[[2]], hd_geos80[[2]], hd_geos90[[2]],
                            hd_geos00[[2]], hd_geos10[[2]], hd_geos20[[2]],)
near_comp_df <- dplyr::bind_rows(nearby_geos60[[3]], nearby_geos70[[3]],nearby_geos80[[3]], nearby_geos90[[3]],
                            nearby_geos00[[3]], nearby_geos10[[3]], nearby_geos20[[3]],)

comp_df <- run_regressions(hd_comp_df, near_comp_df, "pop_dens")
## [1] "_______________________________________________________"
## [1] "D-in-D regression for the % of black residents, unweighted"
## 
## Call:
## lm(formula = main_formula, data = comp_df_subset, weights = wt)
## 
## Residuals:
##        Min         1Q     Median         3Q        Max 
## -0.0089816 -0.0009798  0.0000375  0.0008264  0.0119751 
## 
## Coefficients: (1 not defined because of singularities)
##                                          Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                             5.827e-03  9.820e-04   5.934 7.20e-09 ***
## treatment_group                         7.314e-03  1.403e-03   5.212 3.22e-07 ***
## desig_yet                               8.555e-04  5.154e-04   1.660 0.097828 .  
## unit_idAnacostia near                   2.461e-05  1.306e-03   0.019 0.984977    
## unit_idBlagden Alley/Naylor Court hd    1.976e-03  1.413e-03   1.399 0.162678    
## unit_idBlagden Alley/Naylor Court near  4.278e-03  1.298e-03   3.296 0.001081 ** 
## unit_idBloomingdale hd                  2.768e-03  1.393e-03   1.988 0.047643 *  
## unit_idBloomingdale near                2.205e-03  1.306e-03   1.688 0.092313 .  
## unit_idCapitol Hill hd                 -9.475e-05  1.353e-03  -0.070 0.944203    
## unit_idCapitol Hill near                1.688e-03  1.306e-03   1.292 0.197063    
## unit_idCleveland Park hd               -5.131e-03  1.357e-03  -3.782 0.000183 ***
## unit_idCleveland Park near              5.769e-04  1.300e-03   0.444 0.657465    
## unit_idDowntown hd                     -3.606e-03  1.426e-03  -2.529 0.011880 *  
## unit_idDowntown near                    3.664e-04  1.300e-03   0.282 0.778200    
## unit_idDupont Circle hd                 6.782e-03  1.353e-03   5.014 8.55e-07 ***
## unit_idDupont Circle near               4.699e-03  1.306e-03   3.597 0.000368 ***
## unit_idFinancial hd                    -7.820e-03  1.404e-03  -5.568 5.19e-08 ***
## unit_idFinancial near                  -1.462e-03  1.300e-03  -1.125 0.261470    
## unit_idFoggy Bottom hd                  1.677e-02  1.404e-03  11.942  < 2e-16 ***
## unit_idFoggy Bottom near                2.207e-03  1.300e-03   1.698 0.090386 .  
## unit_idFoxhall hd                      -1.514e-03  1.426e-03  -1.062 0.289031    
## unit_idFoxhall near                    -6.408e-05  1.300e-03  -0.049 0.960711    
## unit_idGeorgetown hd                   -4.545e-03  1.353e-03  -3.359 0.000869 ***
## unit_idGeorgetown near                  7.633e-04  1.316e-03   0.580 0.562446    
## unit_idGreater 14th St hd               9.188e-03  1.365e-03   6.733 6.97e-11 ***
## unit_idGreater 14th St near             4.687e-03  1.298e-03   3.612 0.000349 ***
## unit_idGreater U St hd                  2.979e-03  1.365e-03   2.183 0.029731 *  
## unit_idGreater U St near                8.394e-03  1.298e-03   6.468 3.41e-10 ***
## unit_idGWU / Old West End hd            8.598e-03  1.444e-03   5.954 6.46e-09 ***
## unit_idGWU / Old West End near          1.488e-04  1.306e-03   0.114 0.909398    
## unit_idKalorama Triangle hd             9.581e-03  1.357e-03   7.062 9.08e-12 ***
## unit_idKalorama Triangle near           3.951e-03  1.300e-03   3.040 0.002550 ** 
## unit_idKingman Park hd                 -5.236e-03  1.444e-03  -3.625 0.000332 ***
## unit_idKingman Park near                9.402e-04  1.306e-03   0.720 0.472108    
## unit_idLafayette Square hd             -8.609e-03  1.402e-03  -6.141 2.25e-09 ***
## unit_idLafayette Square near           -1.250e-03  1.306e-03  -0.957 0.339298    
## unit_idLeDroit Park hd                  9.975e-04  1.402e-03   0.712 0.477197    
## unit_idLeDroit Park near                2.792e-03  1.306e-03   2.137 0.033283 *  
## unit_idLogan Circle hd                  8.425e-03  1.402e-03   6.010 4.71e-09 ***
## unit_idLogan Circle near                3.749e-03  1.306e-03   2.871 0.004350 ** 
## unit_idMassachusetts Ave hd            -5.967e-04  1.402e-03  -0.426 0.670597    
## unit_idMassachusetts Ave near           3.029e-04  1.306e-03   0.232 0.816758    
## unit_idMeridian Hill hd                 1.085e-02  1.444e-03   7.513 5.01e-13 ***
## unit_idMeridian Hill near               9.158e-03  1.306e-03   7.012 1.25e-11 ***
## unit_idMt. Pleasant hd                  4.983e-03  1.357e-03   3.673 0.000277 ***
## unit_idMt. Pleasant near                3.986e-03  1.300e-03   3.066 0.002337 ** 
## unit_idMt. Vernon Square hd             7.240e-04  1.413e-03   0.513 0.608589    
## unit_idMt. Vernon Square near           3.652e-03  1.298e-03   2.814 0.005173 ** 
## unit_idPennsylvania Ave NHS hd         -8.430e-03  1.365e-03  -6.177 1.84e-09 ***
## unit_idPennsylvania Ave NHS near       -1.095e-03  1.298e-03  -0.844 0.399208    
## unit_idShaw hd                          8.867e-03  1.365e-03   6.498 2.85e-10 ***
## unit_idShaw near                        4.009e-03  1.298e-03   3.089 0.002169 ** 
## unit_idSheridan-Kalorama hd            -4.683e-03  1.357e-03  -3.452 0.000626 ***
## unit_idSheridan-Kalorama near           1.596e-03  1.300e-03   1.228 0.220382    
## unit_idSixteenth St hd                  1.453e-02  1.402e-03  10.368  < 2e-16 ***
## unit_idSixteenth St near                6.558e-03  1.306e-03   5.021 8.26e-07 ***
## unit_idStrivers' Section hd             1.678e-02  1.404e-03  11.950  < 2e-16 ***
## unit_idStrivers' Section near           1.187e-02  1.300e-03   9.134  < 2e-16 ***
## unit_idTakoma Park hd                  -5.333e-03  1.404e-03  -3.797 0.000173 ***
## unit_idTakoma Park near                 8.635e-04  1.300e-03   0.664 0.506937    
## unit_idWashington Heights hd            9.634e-03  1.426e-03   6.756 6.03e-11 ***
## unit_idWashington Heights near          5.249e-03  1.300e-03   4.038 6.65e-05 ***
## unit_idWoodley Park hd                  4.369e-03  1.413e-03   3.093 0.002142 ** 
## unit_idWoodley Park near                       NA         NA      NA       NA    
## year1970                               -2.828e-03  4.938e-04  -5.727 2.23e-08 ***
## year1980                               -4.441e-03  5.111e-04  -8.688  < 2e-16 ***
## year1990                               -4.629e-03  5.522e-04  -8.383 1.33e-15 ***
## year2000                               -4.645e-03  6.040e-04  -7.691 1.54e-13 ***
## year2010                               -3.884e-03  6.298e-04  -6.167 1.95e-09 ***
## year2020                               -3.006e-03  6.669e-04  -4.508 8.98e-06 ***
## treatment_group:desig_yet              -1.397e-03  5.328e-04  -2.622 0.009119 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.002428 on 345 degrees of freedom
##   (19 observations deleted due to missingness)
## Multiple R-squared:  0.8926, Adjusted R-squared:  0.8711 
## F-statistic: 41.54 on 69 and 345 DF,  p-value: < 2.2e-16
## 
## [1] "__________"
## [1] "Coef. on treatment variable when we add area fixed effects:"
##      Estimate    Std. Error       t value      Pr(>|t|) 
## -0.0013973346  0.0005328495 -2.6223811256  0.0091188683 
## [1] "_______________________________________________________"
## [1] "D-in-D regression for the % of black residents, using population weights"
## 
## Call:
## lm(formula = main_formula, data = comp_df_subset, weights = wt)
## 
## Weighted Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.70314 -0.05877  0.00000  0.04675  0.85145 
## 
## Coefficients: (1 not defined because of singularities)
##                                          Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                             0.0085519  0.0013700   6.242 1.37e-09 ***
## treatment_group                         0.0077817  0.0016958   4.589 6.41e-06 ***
## desig_yet                               0.0014515  0.0005363   2.706 0.007169 ** 
## unit_idAnacostia near                  -0.0003777  0.0016671  -0.227 0.820899    
## unit_idBlagden Alley/Naylor Court hd    0.0022211  0.0029927   0.742 0.458512    
## unit_idBlagden Alley/Naylor Court near  0.0040860  0.0031062   1.315 0.189310    
## unit_idBloomingdale hd                  0.0018928  0.0013191   1.435 0.152294    
## unit_idBloomingdale near                0.0010501  0.0015445   0.680 0.497085    
## unit_idCapitol Hill hd                 -0.0009196  0.0010838  -0.849 0.396777    
## unit_idCapitol Hill near                0.0005213  0.0013812   0.377 0.706119    
## unit_idCleveland Park hd               -0.0060369  0.0013418  -4.499 9.56e-06 ***
## unit_idCleveland Park near             -0.0004491  0.0015862  -0.283 0.777264    
## unit_idDowntown hd                     -0.0025686  0.0024676  -1.041 0.298692    
## unit_idDowntown near                    0.0007798  0.0025997   0.300 0.764397    
## unit_idDupont Circle hd                 0.0064646  0.0011479   5.632 3.91e-08 ***
## unit_idDupont Circle near               0.0038246  0.0014323   2.670 0.007967 ** 
## unit_idFinancial hd                    -0.0065386  0.0056994  -1.147 0.252138    
## unit_idFinancial near                  -0.0020924  0.0057629  -0.363 0.716790    
## unit_idFoggy Bottom hd                  0.0172889  0.0022056   7.839 6.81e-14 ***
## unit_idFoggy Bottom near                0.0014678  0.0023617   0.622 0.534701    
## unit_idFoxhall hd                      -0.0021606  0.0027651  -0.781 0.435161    
## unit_idFoxhall near                    -0.0006787  0.0028811  -0.236 0.813922    
## unit_idGeorgetown hd                   -0.0053316  0.0011607  -4.594 6.28e-06 ***
## unit_idGeorgetown near                 -0.0003219  0.0014529  -0.222 0.824787    
## unit_idGreater 14th St hd               0.0091644  0.0012325   7.436 9.61e-13 ***
## unit_idGreater 14th St near             0.0036858  0.0014872   2.478 0.013713 *  
## unit_idGreater U St hd                  0.0023342  0.0012346   1.891 0.059579 .  
## unit_idGreater U St near                0.0074765  0.0014884   5.023 8.47e-07 ***
## unit_idGWU / Old West End hd            0.0112732  0.0017409   6.475 3.56e-10 ***
## unit_idGWU / Old West End near          0.0006529  0.0019140   0.341 0.733220    
## unit_idKalorama Triangle hd             0.0098665  0.0014042   7.026 1.28e-11 ***
## unit_idKalorama Triangle near           0.0032553  0.0016380   1.987 0.047731 *  
## unit_idKingman Park hd                 -0.0058188  0.0016190  -3.594 0.000377 ***
## unit_idKingman Park near                0.0009191  0.0018029   0.510 0.610560    
## unit_idLafayette Square hd             -0.0101118  0.0146705  -0.689 0.491162    
## unit_idLafayette Square near           -0.0015802  0.0146948  -0.108 0.914433    
## unit_idLeDroit Park hd                  0.0009080  0.0020266   0.448 0.654408    
## unit_idLeDroit Park near                0.0020964  0.0022044   0.951 0.342306    
## unit_idLogan Circle hd                  0.0080444  0.0021349   3.768 0.000196 ***
## unit_idLogan Circle near                0.0034944  0.0023025   1.518 0.130079    
## unit_idMassachusetts Ave hd            -0.0010990  0.0016344  -0.672 0.501805    
## unit_idMassachusetts Ave near          -0.0006319  0.0018479  -0.342 0.732594    
## unit_idMeridian Hill hd                 0.0103813  0.0014638   7.092 8.52e-12 ***
## unit_idMeridian Hill near               0.0097628  0.0016640   5.867 1.11e-08 ***
## unit_idMt. Pleasant hd                  0.0042435  0.0011937   3.555 0.000435 ***
## unit_idMt. Pleasant near                0.0028701  0.0014628   1.962 0.050625 .  
## unit_idMt. Vernon Square hd             0.0004541  0.0019554   0.232 0.816523    
## unit_idMt. Vernon Square near           0.0034248  0.0021240   1.612 0.107849    
## unit_idPennsylvania Ave NHS hd         -0.0093238  0.0022488  -4.146 4.34e-05 ***
## unit_idPennsylvania Ave NHS near       -0.0026449  0.0024024  -1.101 0.271741    
## unit_idShaw hd                          0.0091918  0.0013219   6.953 2.01e-11 ***
## unit_idShaw near                        0.0029142  0.0015628   1.865 0.063128 .  
## unit_idSheridan-Kalorama hd            -0.0058207  0.0015592  -3.733 0.000224 ***
## unit_idSheridan-Kalorama near           0.0006932  0.0017730   0.391 0.696066    
## unit_idSixteenth St hd                  0.0139904  0.0013506  10.359  < 2e-16 ***
## unit_idSixteenth St near                0.0052871  0.0016032   3.298 0.001084 ** 
## unit_idStrivers' Section hd             0.0163765  0.0015758  10.393  < 2e-16 ***
## unit_idStrivers' Section near           0.0116816  0.0017879   6.534 2.52e-10 ***
## unit_idTakoma Park hd                  -0.0058132  0.0020395  -2.850 0.004652 ** 
## unit_idTakoma Park near                 0.0005025  0.0022082   0.228 0.820115    
## unit_idWashington Heights hd            0.0091643  0.0015614   5.869 1.09e-08 ***
## unit_idWashington Heights near          0.0042459  0.0017597   2.413 0.016393 *  
## unit_idWoodley Park hd                  0.0038257  0.0016671   2.295 0.022392 *  
## unit_idWoodley Park near                       NA         NA      NA       NA    
## year1970                               -0.0049768  0.0004420 -11.260  < 2e-16 ***
## year1980                               -0.0068733  0.0005187 -13.251  < 2e-16 ***
## year1990                               -0.0070877  0.0005714 -12.405  < 2e-16 ***
## year2000                               -0.0070691  0.0006204 -11.395  < 2e-16 ***
## year2010                               -0.0066223  0.0006238 -10.617  < 2e-16 ***
## year2020                               -0.0054695  0.0006592  -8.297 3.01e-15 ***
## treatment_group:desig_yet              -0.0022407  0.0005196  -4.312 2.15e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.1675 on 320 degrees of freedom
##   (38 observations deleted due to missingness)
## Multiple R-squared:  0.8972, Adjusted R-squared:  0.875 
## F-statistic: 40.48 on 69 and 320 DF,  p-value: < 2.2e-16
## 
## [1] "__________"
## [1] "Coef. on treatment variable when we add area fixed effects:"
##      Estimate    Std. Error       t value      Pr(>|t|) 
## -0.0022406873  0.0005195934 -4.3123863862  0.0000215373 
## [1] "_______________________________________________________"
## [1] "D-in-D regression for the % of white residents, unweighted"
## 
## Call:
## lm(formula = main_formula, data = comp_df_subset, weights = wt)
## 
## Residuals:
##        Min         1Q     Median         3Q        Max 
## -0.0089816 -0.0009798  0.0000375  0.0008264  0.0119751 
## 
## Coefficients: (1 not defined because of singularities)
##                                          Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                             5.827e-03  9.820e-04   5.934 7.20e-09 ***
## treatment_group                         7.314e-03  1.403e-03   5.212 3.22e-07 ***
## desig_yet                               8.555e-04  5.154e-04   1.660 0.097828 .  
## unit_idAnacostia near                   2.461e-05  1.306e-03   0.019 0.984977    
## unit_idBlagden Alley/Naylor Court hd    1.976e-03  1.413e-03   1.399 0.162678    
## unit_idBlagden Alley/Naylor Court near  4.278e-03  1.298e-03   3.296 0.001081 ** 
## unit_idBloomingdale hd                  2.768e-03  1.393e-03   1.988 0.047643 *  
## unit_idBloomingdale near                2.205e-03  1.306e-03   1.688 0.092313 .  
## unit_idCapitol Hill hd                 -9.475e-05  1.353e-03  -0.070 0.944203    
## unit_idCapitol Hill near                1.688e-03  1.306e-03   1.292 0.197063    
## unit_idCleveland Park hd               -5.131e-03  1.357e-03  -3.782 0.000183 ***
## unit_idCleveland Park near              5.769e-04  1.300e-03   0.444 0.657465    
## unit_idDowntown hd                     -3.606e-03  1.426e-03  -2.529 0.011880 *  
## unit_idDowntown near                    3.664e-04  1.300e-03   0.282 0.778200    
## unit_idDupont Circle hd                 6.782e-03  1.353e-03   5.014 8.55e-07 ***
## unit_idDupont Circle near               4.699e-03  1.306e-03   3.597 0.000368 ***
## unit_idFinancial hd                    -7.820e-03  1.404e-03  -5.568 5.19e-08 ***
## unit_idFinancial near                  -1.462e-03  1.300e-03  -1.125 0.261470    
## unit_idFoggy Bottom hd                  1.677e-02  1.404e-03  11.942  < 2e-16 ***
## unit_idFoggy Bottom near                2.207e-03  1.300e-03   1.698 0.090386 .  
## unit_idFoxhall hd                      -1.514e-03  1.426e-03  -1.062 0.289031    
## unit_idFoxhall near                    -6.408e-05  1.300e-03  -0.049 0.960711    
## unit_idGeorgetown hd                   -4.545e-03  1.353e-03  -3.359 0.000869 ***
## unit_idGeorgetown near                  7.633e-04  1.316e-03   0.580 0.562446    
## unit_idGreater 14th St hd               9.188e-03  1.365e-03   6.733 6.97e-11 ***
## unit_idGreater 14th St near             4.687e-03  1.298e-03   3.612 0.000349 ***
## unit_idGreater U St hd                  2.979e-03  1.365e-03   2.183 0.029731 *  
## unit_idGreater U St near                8.394e-03  1.298e-03   6.468 3.41e-10 ***
## unit_idGWU / Old West End hd            8.598e-03  1.444e-03   5.954 6.46e-09 ***
## unit_idGWU / Old West End near          1.488e-04  1.306e-03   0.114 0.909398    
## unit_idKalorama Triangle hd             9.581e-03  1.357e-03   7.062 9.08e-12 ***
## unit_idKalorama Triangle near           3.951e-03  1.300e-03   3.040 0.002550 ** 
## unit_idKingman Park hd                 -5.236e-03  1.444e-03  -3.625 0.000332 ***
## unit_idKingman Park near                9.402e-04  1.306e-03   0.720 0.472108    
## unit_idLafayette Square hd             -8.609e-03  1.402e-03  -6.141 2.25e-09 ***
## unit_idLafayette Square near           -1.250e-03  1.306e-03  -0.957 0.339298    
## unit_idLeDroit Park hd                  9.975e-04  1.402e-03   0.712 0.477197    
## unit_idLeDroit Park near                2.792e-03  1.306e-03   2.137 0.033283 *  
## unit_idLogan Circle hd                  8.425e-03  1.402e-03   6.010 4.71e-09 ***
## unit_idLogan Circle near                3.749e-03  1.306e-03   2.871 0.004350 ** 
## unit_idMassachusetts Ave hd            -5.967e-04  1.402e-03  -0.426 0.670597    
## unit_idMassachusetts Ave near           3.029e-04  1.306e-03   0.232 0.816758    
## unit_idMeridian Hill hd                 1.085e-02  1.444e-03   7.513 5.01e-13 ***
## unit_idMeridian Hill near               9.158e-03  1.306e-03   7.012 1.25e-11 ***
## unit_idMt. Pleasant hd                  4.983e-03  1.357e-03   3.673 0.000277 ***
## unit_idMt. Pleasant near                3.986e-03  1.300e-03   3.066 0.002337 ** 
## unit_idMt. Vernon Square hd             7.240e-04  1.413e-03   0.513 0.608589    
## unit_idMt. Vernon Square near           3.652e-03  1.298e-03   2.814 0.005173 ** 
## unit_idPennsylvania Ave NHS hd         -8.430e-03  1.365e-03  -6.177 1.84e-09 ***
## unit_idPennsylvania Ave NHS near       -1.095e-03  1.298e-03  -0.844 0.399208    
## unit_idShaw hd                          8.867e-03  1.365e-03   6.498 2.85e-10 ***
## unit_idShaw near                        4.009e-03  1.298e-03   3.089 0.002169 ** 
## unit_idSheridan-Kalorama hd            -4.683e-03  1.357e-03  -3.452 0.000626 ***
## unit_idSheridan-Kalorama near           1.596e-03  1.300e-03   1.228 0.220382    
## unit_idSixteenth St hd                  1.453e-02  1.402e-03  10.368  < 2e-16 ***
## unit_idSixteenth St near                6.558e-03  1.306e-03   5.021 8.26e-07 ***
## unit_idStrivers' Section hd             1.678e-02  1.404e-03  11.950  < 2e-16 ***
## unit_idStrivers' Section near           1.187e-02  1.300e-03   9.134  < 2e-16 ***
## unit_idTakoma Park hd                  -5.333e-03  1.404e-03  -3.797 0.000173 ***
## unit_idTakoma Park near                 8.635e-04  1.300e-03   0.664 0.506937    
## unit_idWashington Heights hd            9.634e-03  1.426e-03   6.756 6.03e-11 ***
## unit_idWashington Heights near          5.249e-03  1.300e-03   4.038 6.65e-05 ***
## unit_idWoodley Park hd                  4.369e-03  1.413e-03   3.093 0.002142 ** 
## unit_idWoodley Park near                       NA         NA      NA       NA    
## year1970                               -2.828e-03  4.938e-04  -5.727 2.23e-08 ***
## year1980                               -4.441e-03  5.111e-04  -8.688  < 2e-16 ***
## year1990                               -4.629e-03  5.522e-04  -8.383 1.33e-15 ***
## year2000                               -4.645e-03  6.040e-04  -7.691 1.54e-13 ***
## year2010                               -3.884e-03  6.298e-04  -6.167 1.95e-09 ***
## year2020                               -3.006e-03  6.669e-04  -4.508 8.98e-06 ***
## treatment_group:desig_yet              -1.397e-03  5.328e-04  -2.622 0.009119 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.002428 on 345 degrees of freedom
##   (19 observations deleted due to missingness)
## Multiple R-squared:  0.8926, Adjusted R-squared:  0.8711 
## F-statistic: 41.54 on 69 and 345 DF,  p-value: < 2.2e-16
## 
## [1] "__________"
## [1] "Coef. on treatment variable when we add area fixed effects:"
##      Estimate    Std. Error       t value      Pr(>|t|) 
## -0.0013973346  0.0005328495 -2.6223811256  0.0091188683 
## [1] "_______________________________________________________"
## [1] "D-in-D regression for the % of white residents, using population weights"
## 
## Call:
## lm(formula = main_formula, data = comp_df_subset, weights = wt)
## 
## Weighted Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.70314 -0.05877  0.00000  0.04675  0.85145 
## 
## Coefficients: (1 not defined because of singularities)
##                                          Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                             0.0085519  0.0013700   6.242 1.37e-09 ***
## treatment_group                         0.0077817  0.0016958   4.589 6.41e-06 ***
## desig_yet                               0.0014515  0.0005363   2.706 0.007169 ** 
## unit_idAnacostia near                  -0.0003777  0.0016671  -0.227 0.820899    
## unit_idBlagden Alley/Naylor Court hd    0.0022211  0.0029927   0.742 0.458512    
## unit_idBlagden Alley/Naylor Court near  0.0040860  0.0031062   1.315 0.189310    
## unit_idBloomingdale hd                  0.0018928  0.0013191   1.435 0.152294    
## unit_idBloomingdale near                0.0010501  0.0015445   0.680 0.497085    
## unit_idCapitol Hill hd                 -0.0009196  0.0010838  -0.849 0.396777    
## unit_idCapitol Hill near                0.0005213  0.0013812   0.377 0.706119    
## unit_idCleveland Park hd               -0.0060369  0.0013418  -4.499 9.56e-06 ***
## unit_idCleveland Park near             -0.0004491  0.0015862  -0.283 0.777264    
## unit_idDowntown hd                     -0.0025686  0.0024676  -1.041 0.298692    
## unit_idDowntown near                    0.0007798  0.0025997   0.300 0.764397    
## unit_idDupont Circle hd                 0.0064646  0.0011479   5.632 3.91e-08 ***
## unit_idDupont Circle near               0.0038246  0.0014323   2.670 0.007967 ** 
## unit_idFinancial hd                    -0.0065386  0.0056994  -1.147 0.252138    
## unit_idFinancial near                  -0.0020924  0.0057629  -0.363 0.716790    
## unit_idFoggy Bottom hd                  0.0172889  0.0022056   7.839 6.81e-14 ***
## unit_idFoggy Bottom near                0.0014678  0.0023617   0.622 0.534701    
## unit_idFoxhall hd                      -0.0021606  0.0027651  -0.781 0.435161    
## unit_idFoxhall near                    -0.0006787  0.0028811  -0.236 0.813922    
## unit_idGeorgetown hd                   -0.0053316  0.0011607  -4.594 6.28e-06 ***
## unit_idGeorgetown near                 -0.0003219  0.0014529  -0.222 0.824787    
## unit_idGreater 14th St hd               0.0091644  0.0012325   7.436 9.61e-13 ***
## unit_idGreater 14th St near             0.0036858  0.0014872   2.478 0.013713 *  
## unit_idGreater U St hd                  0.0023342  0.0012346   1.891 0.059579 .  
## unit_idGreater U St near                0.0074765  0.0014884   5.023 8.47e-07 ***
## unit_idGWU / Old West End hd            0.0112732  0.0017409   6.475 3.56e-10 ***
## unit_idGWU / Old West End near          0.0006529  0.0019140   0.341 0.733220    
## unit_idKalorama Triangle hd             0.0098665  0.0014042   7.026 1.28e-11 ***
## unit_idKalorama Triangle near           0.0032553  0.0016380   1.987 0.047731 *  
## unit_idKingman Park hd                 -0.0058188  0.0016190  -3.594 0.000377 ***
## unit_idKingman Park near                0.0009191  0.0018029   0.510 0.610560    
## unit_idLafayette Square hd             -0.0101118  0.0146705  -0.689 0.491162    
## unit_idLafayette Square near           -0.0015802  0.0146948  -0.108 0.914433    
## unit_idLeDroit Park hd                  0.0009080  0.0020266   0.448 0.654408    
## unit_idLeDroit Park near                0.0020964  0.0022044   0.951 0.342306    
## unit_idLogan Circle hd                  0.0080444  0.0021349   3.768 0.000196 ***
## unit_idLogan Circle near                0.0034944  0.0023025   1.518 0.130079    
## unit_idMassachusetts Ave hd            -0.0010990  0.0016344  -0.672 0.501805    
## unit_idMassachusetts Ave near          -0.0006319  0.0018479  -0.342 0.732594    
## unit_idMeridian Hill hd                 0.0103813  0.0014638   7.092 8.52e-12 ***
## unit_idMeridian Hill near               0.0097628  0.0016640   5.867 1.11e-08 ***
## unit_idMt. Pleasant hd                  0.0042435  0.0011937   3.555 0.000435 ***
## unit_idMt. Pleasant near                0.0028701  0.0014628   1.962 0.050625 .  
## unit_idMt. Vernon Square hd             0.0004541  0.0019554   0.232 0.816523    
## unit_idMt. Vernon Square near           0.0034248  0.0021240   1.612 0.107849    
## unit_idPennsylvania Ave NHS hd         -0.0093238  0.0022488  -4.146 4.34e-05 ***
## unit_idPennsylvania Ave NHS near       -0.0026449  0.0024024  -1.101 0.271741    
## unit_idShaw hd                          0.0091918  0.0013219   6.953 2.01e-11 ***
## unit_idShaw near                        0.0029142  0.0015628   1.865 0.063128 .  
## unit_idSheridan-Kalorama hd            -0.0058207  0.0015592  -3.733 0.000224 ***
## unit_idSheridan-Kalorama near           0.0006932  0.0017730   0.391 0.696066    
## unit_idSixteenth St hd                  0.0139904  0.0013506  10.359  < 2e-16 ***
## unit_idSixteenth St near                0.0052871  0.0016032   3.298 0.001084 ** 
## unit_idStrivers' Section hd             0.0163765  0.0015758  10.393  < 2e-16 ***
## unit_idStrivers' Section near           0.0116816  0.0017879   6.534 2.52e-10 ***
## unit_idTakoma Park hd                  -0.0058132  0.0020395  -2.850 0.004652 ** 
## unit_idTakoma Park near                 0.0005025  0.0022082   0.228 0.820115    
## unit_idWashington Heights hd            0.0091643  0.0015614   5.869 1.09e-08 ***
## unit_idWashington Heights near          0.0042459  0.0017597   2.413 0.016393 *  
## unit_idWoodley Park hd                  0.0038257  0.0016671   2.295 0.022392 *  
## unit_idWoodley Park near                       NA         NA      NA       NA    
## year1970                               -0.0049768  0.0004420 -11.260  < 2e-16 ***
## year1980                               -0.0068733  0.0005187 -13.251  < 2e-16 ***
## year1990                               -0.0070877  0.0005714 -12.405  < 2e-16 ***
## year2000                               -0.0070691  0.0006204 -11.395  < 2e-16 ***
## year2010                               -0.0066223  0.0006238 -10.617  < 2e-16 ***
## year2020                               -0.0054695  0.0006592  -8.297 3.01e-15 ***
## treatment_group:desig_yet              -0.0022407  0.0005196  -4.312 2.15e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.1675 on 320 degrees of freedom
##   (38 observations deleted due to missingness)
## Multiple R-squared:  0.8972, Adjusted R-squared:  0.875 
## F-statistic: 40.48 on 69 and 320 DF,  p-value: < 2.2e-16
## 
## [1] "__________"
## [1] "Coef. on treatment variable when we add area fixed effects:"
##      Estimate    Std. Error       t value      Pr(>|t|) 
## -0.0022406873  0.0005195934 -4.3123863862  0.0000215373
## 
## Call:
## did::att_gt(yname = dep_var, tname = "year", idname = "unit_id_num", 
##     gname = "first_decade_desig", xformla = ~1, data = comp_df[comp_df$group == 
##         "black" & !is.na(comp_df$n_tot_hd), ], allow_unbalanced_panel = T, 
##     weightsname = "n_tot_hd")
## 
## Reference: Callaway, Brantly and Pedro H.C. Sant'Anna.  "Difference-in-Differences with Multiple Time Periods." Journal of Econometrics, Vol. 225, No. 2, pp. 200-230, 2021. <https://doi.org/10.1016/j.jeconom.2020.12.001>, <https://arxiv.org/abs/1803.09015> 
## 
## Group-Time Average Treatment Effects:
##  Group Time ATT(g,t) Std. Error [95% Simult.  Conf. Band]  
##   1970 1970   0.0030     0.0011        0.0000      0.0059  
##   1970 1980   0.0038     0.0011        0.0009      0.0068 *
##   1970 1990   0.0043     0.0011        0.0013      0.0073 *
##   1970 2000   0.0047     0.0011        0.0017      0.0076 *
##   1970 2010   0.0045     0.0010        0.0018      0.0073 *
##   1970 2020   0.0030     0.0010        0.0003      0.0056 *
##   1980 1970  -0.0035     0.0032       -0.0123      0.0053  
##   1980 1980  -0.0016     0.0005       -0.0028     -0.0003 *
##   1980 1990  -0.0018     0.0008       -0.0039      0.0004  
##   1980 2000  -0.0018     0.0006       -0.0033     -0.0002 *
##   1980 2010  -0.0024     0.0004       -0.0036     -0.0012 *
##   1980 2020  -0.0029     0.0007       -0.0047     -0.0011 *
##   1990 1970  -0.0007     0.0057       -0.0161      0.0148  
##   1990 1980   0.0000     0.0017       -0.0046      0.0046  
##   1990 1990  -0.0002     0.0011       -0.0032      0.0028  
##   1990 2000   0.0001     0.0015       -0.0039      0.0041  
##   1990 2010  -0.0019     0.0008       -0.0042      0.0003  
##   1990 2020  -0.0034     0.0010       -0.0061     -0.0006 *
##   2000 1970  -0.0068     0.0037       -0.0169      0.0032  
##   2000 1980  -0.0040     0.0006       -0.0057     -0.0023 *
##   2000 1990   0.0004     0.0005       -0.0010      0.0018  
##   2000 2000   0.0007     0.0008       -0.0016      0.0030  
##   2000 2010   0.0015     0.0015       -0.0025      0.0055  
##   2000 2020   0.0025     0.0014       -0.0014      0.0063  
##   2010 1970       NA         NA            NA          NA  
##   2010 1980  -0.0049     0.0013       -0.0084     -0.0014 *
##   2010 1990   0.0004     0.0004       -0.0007      0.0015  
##   2010 2000  -0.0011     0.0004       -0.0022     -0.0001 *
##   2010 2010   0.0001     0.0002       -0.0004      0.0006  
##   2010 2020   0.0006     0.0007       -0.0014      0.0027  
##   2020 1970  -0.0006     0.0049       -0.0139      0.0127  
##   2020 1980  -0.0008     0.0036       -0.0105      0.0089  
##   2020 1990  -0.0015     0.0020       -0.0069      0.0038  
##   2020 2000  -0.0008     0.0003       -0.0018      0.0001  
##   2020 2010   0.0047     0.0040       -0.0061      0.0155  
##   2020 2020  -0.0008     0.0010       -0.0035      0.0020  
## ---
## Signif. codes: `*' confidence band does not cover 0
## 
## P-value for pre-test of parallel trends assumption:  0
## Control Group:  Never Treated,  Anticipation Periods:  0
## Estimation Method:  Doubly Robust
## NULL
## 
## Call:
## aggte(MP = hd.attgt, type = "group", na.rm = T)
## 
## Reference: Callaway, Brantly and Pedro H.C. Sant'Anna.  "Difference-in-Differences with Multiple Time Periods." Journal of Econometrics, Vol. 225, No. 2, pp. 200-230, 2021. <https://doi.org/10.1016/j.jeconom.2020.12.001>, <https://arxiv.org/abs/1803.09015> 
## 
## 
## Overall summary of ATT's based on group/cohort aggregation:  
##     ATT    Std. Error     [ 95%  Conf. Int.] 
##  -5e-04         6e-04    -0.0016       6e-04 
## 
## 
## Group Effects:
##  Group Estimate Std. Error [95% Simult.  Conf. Band]  
##   1970   0.0039      1e-03        0.0018      0.0060 *
##   1980  -0.0021      5e-04       -0.0031     -0.0010 *
##   1990  -0.0013      8e-04       -0.0031      0.0004  
##   2000   0.0015      1e-03       -0.0006      0.0037  
##   2010   0.0004      4e-04       -0.0004      0.0011  
##   2020  -0.0008      1e-03       -0.0029      0.0013  
## ---
## Signif. codes: `*' confidence band does not cover 0
## 
## Control Group:  Never Treated,  Anticipation Periods:  0
## Estimation Method:  Doubly Robust
## NULL
plot_ly(
    data = comp_df[comp_df$group=="black",] %>% arrange(LABEL, year_index),
    x = ~year_index,    # year_index
    y = ~pop_in_unit,  # ~percent_std or ~percent
    color = ~LABEL,  # Specify the grouping variable for color
    linetype = ~as.factor(treatment_control),
    type = "scatter",
    mode = "lines+markers",
    hoverinfo=~as.character(first_decade_desig)
  )

Robustness checks

rv <- run_all(mp=.25, buff_dist=.001, threshold=.1, dep_var = "pop_dens")
## [1] "_______________________________________________________"
## [1] "D-in-D regression for the % of black residents, unweighted"
## 
## Call:
## lm(formula = main_formula, data = comp_df_subset, weights = wt)
## 
## Residuals:
##        Min         1Q     Median         3Q        Max 
## -0.0090062 -0.0010748 -0.0000120  0.0009732  0.0112101 
## 
## Coefficients: (1 not defined because of singularities)
##                                          Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                             8.114e-03  1.065e-03   7.620 2.66e-13 ***
## treatment_group                         5.925e-03  1.483e-03   3.995 7.98e-05 ***
## desig_yet                               7.924e-04  5.508e-04   1.439 0.151224    
## unit_idAnacostia near                  -1.547e-03  1.381e-03  -1.121 0.263296    
## unit_idBlagden Alley/Naylor Court hd    1.999e-03  1.493e-03   1.339 0.181423    
## unit_idBlagden Alley/Naylor Court near -2.136e-04  1.430e-03  -0.149 0.881297    
## unit_idBloomingdale hd                  2.679e-03  1.472e-03   1.820 0.069613 .  
## unit_idBloomingdale near                7.140e-04  1.381e-03   0.517 0.605415    
## unit_idCapitol Hill hd                 -2.229e-04  1.430e-03  -0.156 0.876224    
## unit_idCapitol Hill near               -4.292e-05  1.381e-03  -0.031 0.975220    
## unit_idCleveland Park hd               -5.249e-03  1.434e-03  -3.660 0.000293 ***
## unit_idCleveland Park near             -1.001e-03  1.374e-03  -0.729 0.466755    
## unit_idDowntown hd                     -3.571e-03  1.507e-03  -2.370 0.018381 *  
## unit_idDowntown near                    3.942e-04  1.374e-03   0.287 0.774373    
## unit_idDupont Circle hd                 6.654e-03  1.430e-03   4.653 4.73e-06 ***
## unit_idDupont Circle near               1.695e-04  1.381e-03   0.123 0.902377    
## unit_idFinancial hd                    -7.809e-03  1.485e-03  -5.260 2.58e-07 ***
## unit_idFinancial near                  -3.475e-03  1.433e-03  -2.426 0.015814 *  
## unit_idFoggy Bottom hd                  1.678e-02  1.485e-03  11.306  < 2e-16 ***
## unit_idFoggy Bottom near                4.539e-03  1.433e-03   3.168 0.001678 ** 
## unit_idFoxhall hd                      -1.479e-03  1.507e-03  -0.981 0.327066    
## unit_idFoxhall near                    -1.626e-03  1.432e-03  -1.135 0.257201    
## unit_idGeorgetown hd                   -4.683e-03  1.430e-03  -3.274 0.001173 ** 
## unit_idGeorgetown near                 -2.210e-03  1.392e-03  -1.588 0.113311    
## unit_idGreater 14th St hd               9.080e-03  1.443e-03   6.294 9.75e-10 ***
## unit_idGreater 14th St near             6.154e-03  1.430e-03   4.305 2.20e-05 ***
## unit_idGreater U St hd                  2.870e-03  1.443e-03   1.990 0.047436 *  
## unit_idGreater U St near                4.997e-03  1.372e-03   3.643 0.000313 ***
## unit_idGWU / Old West End hd            8.645e-03  1.527e-03   5.662 3.23e-08 ***
## unit_idGWU / Old West End near          6.147e-03  1.381e-03   4.452 1.16e-05 ***
## unit_idKalorama Triangle hd             9.463e-03  1.434e-03   6.598 1.64e-10 ***
## unit_idKalorama Triangle near           2.225e-03  1.374e-03   1.619 0.106323    
## unit_idKingman Park hd                 -5.190e-03  1.527e-03  -3.399 0.000758 ***
## unit_idKingman Park near               -2.112e-03  1.381e-03  -1.530 0.127086    
## unit_idLafayette Square hd             -8.609e-03  1.482e-03  -5.810 1.46e-08 ***
## unit_idLafayette Square near           -3.290e-03  1.442e-03  -2.282 0.023125 *  
## unit_idLeDroit Park hd                  9.975e-04  1.482e-03   0.673 0.501256    
## unit_idLeDroit Park near                2.069e-03  1.381e-03   1.499 0.134882    
## unit_idLogan Circle hd                  8.425e-03  1.482e-03   5.686 2.84e-08 ***
## unit_idLogan Circle near                1.470e-02  1.442e-03  10.194  < 2e-16 ***
## unit_idMassachusetts Ave hd            -5.967e-04  1.482e-03  -0.403 0.687388    
## unit_idMassachusetts Ave near          -3.094e-03  1.381e-03  -2.241 0.025692 *  
## unit_idMeridian Hill hd                 1.090e-02  1.527e-03   7.137 5.99e-12 ***
## unit_idMeridian Hill near               1.580e-02  1.381e-03  11.440  < 2e-16 ***
## unit_idMt. Pleasant hd                  4.865e-03  1.434e-03   3.392 0.000777 ***
## unit_idMt. Pleasant near                2.647e-03  1.374e-03   1.926 0.054928 .  
## unit_idMt. Vernon Square hd             7.472e-04  1.493e-03   0.500 0.617092    
## unit_idMt. Vernon Square near           4.947e-03  1.372e-03   3.607 0.000358 ***
## unit_idPennsylvania Ave NHS hd         -8.538e-03  1.443e-03  -5.919 8.07e-09 ***
## unit_idPennsylvania Ave NHS near       -3.542e-03  1.372e-03  -2.582 0.010238 *  
## unit_idShaw hd                          8.759e-03  1.443e-03   6.072 3.45e-09 ***
## unit_idShaw near                        8.366e-03  1.430e-03   5.852 1.17e-08 ***
## unit_idSheridan-Kalorama hd            -4.801e-03  1.434e-03  -3.348 0.000908 ***
## unit_idSheridan-Kalorama near          -3.140e-03  1.433e-03  -2.191 0.029124 *  
## unit_idSixteenth St hd                  1.453e-02  1.482e-03   9.809  < 2e-16 ***
## unit_idSixteenth St near               -1.051e-03  1.442e-03  -0.729 0.466709    
## unit_idStrivers' Section hd             1.680e-02  1.485e-03  11.314  < 2e-16 ***
## unit_idStrivers' Section near           4.666e-03  1.433e-03   3.257 0.001244 ** 
## unit_idTakoma Park hd                  -5.322e-03  1.485e-03  -3.585 0.000388 ***
## unit_idTakoma Park near                -9.467e-04  1.433e-03  -0.661 0.509228    
## unit_idWashington Heights hd            9.668e-03  1.507e-03   6.415 4.84e-10 ***
## unit_idWashington Heights near          7.585e-03  1.374e-03   5.520 6.81e-08 ***
## unit_idWoodley Park hd                  4.392e-03  1.493e-03   2.942 0.003491 ** 
## unit_idWoodley Park near                       NA         NA      NA       NA    
## year1970                               -4.015e-03  5.808e-04  -6.913 2.43e-11 ***
## year1980                               -5.327e-03  5.960e-04  -8.939  < 2e-16 ***
## year1990                               -5.449e-03  6.346e-04  -8.586 3.51e-16 ***
## year2000                               -5.586e-03  6.846e-04  -8.160 6.98e-15 ***
## year2010                               -4.828e-03  7.099e-04  -6.801 4.84e-11 ***
## year2020                               -3.960e-03  7.466e-04  -5.305 2.06e-07 ***
## treatment_group:desig_yet              -1.265e-03  5.715e-04  -2.213 0.027591 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.002566 on 333 degrees of freedom
##   (13 observations deleted due to missingness)
## Multiple R-squared:  0.8966, Adjusted R-squared:  0.8752 
## F-statistic: 41.86 on 69 and 333 DF,  p-value: < 2.2e-16
## 
## [1] "__________"
## [1] "Coef. on treatment variable when we add area fixed effects:"
##      Estimate    Std. Error       t value      Pr(>|t|) 
## -0.0012646118  0.0005715057 -2.2127719758  0.0275912563 
## [1] "_______________________________________________________"
## [1] "D-in-D regression for the % of black residents, using population weights"
## 
## Call:
## lm(formula = main_formula, data = comp_df_subset, weights = wt)
## 
## Weighted Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.71659 -0.06635  0.00000  0.05182  0.83441 
## 
## Coefficients: (1 not defined because of singularities)
##                                          Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                             0.0084885  0.0014021   6.054 3.99e-09 ***
## treatment_group                         0.0080029  0.0017284   4.630 5.33e-06 ***
## desig_yet                               0.0014193  0.0005465   2.597 0.009845 ** 
## unit_idAnacostia near                  -0.0004139  0.0016984  -0.244 0.807602    
## unit_idBlagden Alley/Naylor Court hd    0.0022265  0.0030488   0.730 0.465743    
## unit_idBlagden Alley/Naylor Court near  0.0008974  0.0031644   0.284 0.776900    
## unit_idBloomingdale hd                  0.0018487  0.0013439   1.376 0.169912    
## unit_idBloomingdale near                0.0011979  0.0015738   0.761 0.447124    
## unit_idCapitol Hill hd                 -0.0009560  0.0011042  -0.866 0.387269    
## unit_idCapitol Hill near                0.0005424  0.0014074   0.385 0.700192    
## unit_idCleveland Park hd               -0.0060765  0.0013669  -4.445 1.22e-05 ***
## unit_idCleveland Park near             -0.0004137  0.0016160  -0.256 0.798125    
## unit_idDowntown hd                     -0.0025986  0.0025139  -1.034 0.302068    
## unit_idDowntown near                    0.0019836  0.0026484   0.749 0.454431    
## unit_idDupont Circle hd                 0.0064241  0.0011695   5.493 8.13e-08 ***
## unit_idDupont Circle near               0.0006759  0.0014594   0.463 0.643598    
## unit_idFinancial hd                    -0.0065545  0.0058062  -1.129 0.259801    
## unit_idFinancial near                  -0.0034608  0.0058709  -0.589 0.555956    
## unit_idFoggy Bottom hd                  0.0172797  0.0022469   7.690 1.86e-13 ***
## unit_idFoggy Bottom near                0.0048756  0.0024059   2.027 0.043549 *  
## unit_idFoxhall hd                      -0.0021816  0.0028170  -0.774 0.439243    
## unit_idFoxhall near                    -0.0005973  0.0029351  -0.204 0.838864    
## unit_idGeorgetown hd                   -0.0053650  0.0011826  -4.537 8.12e-06 ***
## unit_idGeorgetown near                 -0.0017087  0.0014801  -1.154 0.249188    
## unit_idGreater 14th St hd               0.0091177  0.0012556   7.262 2.98e-12 ***
## unit_idGreater 14th St near             0.0071601  0.0015624   4.583 6.61e-06 ***
## unit_idGreater U St hd                  0.0023042  0.0012578   1.832 0.067898 .  
## unit_idGreater U St near                0.0056772  0.0015165   3.744 0.000215 ***
## unit_idGWU / Old West End hd            0.0112474  0.0017739   6.341 7.87e-10 ***
## unit_idGWU / Old West End near          0.0080330  0.0019498   4.120 4.84e-05 ***
## unit_idKalorama Triangle hd             0.0098166  0.0014306   6.862 3.58e-11 ***
## unit_idKalorama Triangle near           0.0031853  0.0016690   1.909 0.057224 .  
## unit_idKingman Park hd                 -0.0058304  0.0016498  -3.534 0.000470 ***
## unit_idKingman Park near               -0.0008831  0.0018367  -0.481 0.630987    
## unit_idLafayette Square hd             -0.0100373  0.0149453  -0.672 0.502327    
## unit_idLafayette Square near           -0.0019591  0.0149700  -0.131 0.895962    
## unit_idLeDroit Park hd                  0.0008833  0.0020645   0.428 0.669040    
## unit_idLeDroit Park near                0.0033299  0.0022457   1.483 0.139121    
## unit_idLogan Circle hd                  0.0080348  0.0021749   3.694 0.000260 ***
## unit_idLogan Circle near                0.0154412  0.0023456   6.583 1.91e-10 ***
## unit_idMassachusetts Ave hd            -0.0011017  0.0016650  -0.662 0.508666    
## unit_idMassachusetts Ave near          -0.0028922  0.0018825  -1.536 0.125439    
## unit_idMeridian Hill hd                 0.0103651  0.0014918   6.948 2.11e-11 ***
## unit_idMeridian Hill near               0.0181833  0.0016952  10.727  < 2e-16 ***
## unit_idMt. Pleasant hd                  0.0042010  0.0012161   3.455 0.000626 ***
## unit_idMt. Pleasant near                0.0031240  0.0014904   2.096 0.036863 *  
## unit_idMt. Vernon Square hd             0.0004520  0.0019921   0.227 0.820652    
## unit_idMt. Vernon Square near           0.0065476  0.0021638   3.026 0.002681 ** 
## unit_idPennsylvania Ave NHS hd         -0.0093688  0.0022910  -4.089 5.49e-05 ***
## unit_idPennsylvania Ave NHS near       -0.0035210  0.0024475  -1.439 0.151239    
## unit_idShaw hd                          0.0091484  0.0013467   6.793 5.43e-11 ***
## unit_idShaw near                        0.0092808  0.0016552   5.607 4.48e-08 ***
## unit_idSheridan-Kalorama hd            -0.0058600  0.0015884  -3.689 0.000265 ***
## unit_idSheridan-Kalorama near          -0.0023139  0.0018871  -1.226 0.221038    
## unit_idSixteenth St hd                  0.0139789  0.0013758  10.160  < 2e-16 ***
## unit_idSixteenth St near               -0.0003306  0.0016332  -0.202 0.839713    
## unit_idStrivers' Section hd             0.0163657  0.0016053  10.195  < 2e-16 ***
## unit_idStrivers' Section near           0.0053801  0.0018213   2.954 0.003372 ** 
## unit_idTakoma Park hd                  -0.0058231  0.0020778  -2.803 0.005381 ** 
## unit_idTakoma Park near                -0.0002735  0.0022495  -0.122 0.903314    
## unit_idWashington Heights hd            0.0091533  0.0015909   5.754 2.06e-08 ***
## unit_idWashington Heights near          0.0089191  0.0017927   4.975 1.07e-06 ***
## unit_idWoodley Park hd                  0.0038127  0.0016985   2.245 0.025473 *  
## unit_idWoodley Park near                       NA         NA      NA       NA    
## year1970                               -0.0052674  0.0004645 -11.340  < 2e-16 ***
## year1980                               -0.0069791  0.0005429 -12.855  < 2e-16 ***
## year1990                               -0.0071171  0.0005968 -11.926  < 2e-16 ***
## year2000                               -0.0072192  0.0006468 -11.161  < 2e-16 ***
## year2010                               -0.0066617  0.0006507 -10.237  < 2e-16 ***
## year2020                               -0.0056558  0.0006868  -8.236 4.74e-15 ***
## treatment_group:desig_yet              -0.0022210  0.0005341  -4.159 4.12e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.1706 on 317 degrees of freedom
##   (23 observations deleted due to missingness)
## Multiple R-squared:  0.9051, Adjusted R-squared:  0.8845 
## F-statistic: 43.84 on 69 and 317 DF,  p-value: < 2.2e-16
## 
## [1] "__________"
## [1] "Coef. on treatment variable when we add area fixed effects:"
##      Estimate    Std. Error       t value      Pr(>|t|) 
## -0.0022209703  0.0005340506 -4.1587266533  0.0000412437 
## [1] "_______________________________________________________"
## [1] "D-in-D regression for the % of white residents, unweighted"
## 
## Call:
## lm(formula = main_formula, data = comp_df_subset, weights = wt)
## 
## Residuals:
##        Min         1Q     Median         3Q        Max 
## -0.0090062 -0.0010748 -0.0000120  0.0009732  0.0112101 
## 
## Coefficients: (1 not defined because of singularities)
##                                          Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                             8.114e-03  1.065e-03   7.620 2.66e-13 ***
## treatment_group                         5.925e-03  1.483e-03   3.995 7.98e-05 ***
## desig_yet                               7.924e-04  5.508e-04   1.439 0.151224    
## unit_idAnacostia near                  -1.547e-03  1.381e-03  -1.121 0.263296    
## unit_idBlagden Alley/Naylor Court hd    1.999e-03  1.493e-03   1.339 0.181423    
## unit_idBlagden Alley/Naylor Court near -2.136e-04  1.430e-03  -0.149 0.881297    
## unit_idBloomingdale hd                  2.679e-03  1.472e-03   1.820 0.069613 .  
## unit_idBloomingdale near                7.140e-04  1.381e-03   0.517 0.605415    
## unit_idCapitol Hill hd                 -2.229e-04  1.430e-03  -0.156 0.876224    
## unit_idCapitol Hill near               -4.292e-05  1.381e-03  -0.031 0.975220    
## unit_idCleveland Park hd               -5.249e-03  1.434e-03  -3.660 0.000293 ***
## unit_idCleveland Park near             -1.001e-03  1.374e-03  -0.729 0.466755    
## unit_idDowntown hd                     -3.571e-03  1.507e-03  -2.370 0.018381 *  
## unit_idDowntown near                    3.942e-04  1.374e-03   0.287 0.774373    
## unit_idDupont Circle hd                 6.654e-03  1.430e-03   4.653 4.73e-06 ***
## unit_idDupont Circle near               1.695e-04  1.381e-03   0.123 0.902377    
## unit_idFinancial hd                    -7.809e-03  1.485e-03  -5.260 2.58e-07 ***
## unit_idFinancial near                  -3.475e-03  1.433e-03  -2.426 0.015814 *  
## unit_idFoggy Bottom hd                  1.678e-02  1.485e-03  11.306  < 2e-16 ***
## unit_idFoggy Bottom near                4.539e-03  1.433e-03   3.168 0.001678 ** 
## unit_idFoxhall hd                      -1.479e-03  1.507e-03  -0.981 0.327066    
## unit_idFoxhall near                    -1.626e-03  1.432e-03  -1.135 0.257201    
## unit_idGeorgetown hd                   -4.683e-03  1.430e-03  -3.274 0.001173 ** 
## unit_idGeorgetown near                 -2.210e-03  1.392e-03  -1.588 0.113311    
## unit_idGreater 14th St hd               9.080e-03  1.443e-03   6.294 9.75e-10 ***
## unit_idGreater 14th St near             6.154e-03  1.430e-03   4.305 2.20e-05 ***
## unit_idGreater U St hd                  2.870e-03  1.443e-03   1.990 0.047436 *  
## unit_idGreater U St near                4.997e-03  1.372e-03   3.643 0.000313 ***
## unit_idGWU / Old West End hd            8.645e-03  1.527e-03   5.662 3.23e-08 ***
## unit_idGWU / Old West End near          6.147e-03  1.381e-03   4.452 1.16e-05 ***
## unit_idKalorama Triangle hd             9.463e-03  1.434e-03   6.598 1.64e-10 ***
## unit_idKalorama Triangle near           2.225e-03  1.374e-03   1.619 0.106323    
## unit_idKingman Park hd                 -5.190e-03  1.527e-03  -3.399 0.000758 ***
## unit_idKingman Park near               -2.112e-03  1.381e-03  -1.530 0.127086    
## unit_idLafayette Square hd             -8.609e-03  1.482e-03  -5.810 1.46e-08 ***
## unit_idLafayette Square near           -3.290e-03  1.442e-03  -2.282 0.023125 *  
## unit_idLeDroit Park hd                  9.975e-04  1.482e-03   0.673 0.501256    
## unit_idLeDroit Park near                2.069e-03  1.381e-03   1.499 0.134882    
## unit_idLogan Circle hd                  8.425e-03  1.482e-03   5.686 2.84e-08 ***
## unit_idLogan Circle near                1.470e-02  1.442e-03  10.194  < 2e-16 ***
## unit_idMassachusetts Ave hd            -5.967e-04  1.482e-03  -0.403 0.687388    
## unit_idMassachusetts Ave near          -3.094e-03  1.381e-03  -2.241 0.025692 *  
## unit_idMeridian Hill hd                 1.090e-02  1.527e-03   7.137 5.99e-12 ***
## unit_idMeridian Hill near               1.580e-02  1.381e-03  11.440  < 2e-16 ***
## unit_idMt. Pleasant hd                  4.865e-03  1.434e-03   3.392 0.000777 ***
## unit_idMt. Pleasant near                2.647e-03  1.374e-03   1.926 0.054928 .  
## unit_idMt. Vernon Square hd             7.472e-04  1.493e-03   0.500 0.617092    
## unit_idMt. Vernon Square near           4.947e-03  1.372e-03   3.607 0.000358 ***
## unit_idPennsylvania Ave NHS hd         -8.538e-03  1.443e-03  -5.919 8.07e-09 ***
## unit_idPennsylvania Ave NHS near       -3.542e-03  1.372e-03  -2.582 0.010238 *  
## unit_idShaw hd                          8.759e-03  1.443e-03   6.072 3.45e-09 ***
## unit_idShaw near                        8.366e-03  1.430e-03   5.852 1.17e-08 ***
## unit_idSheridan-Kalorama hd            -4.801e-03  1.434e-03  -3.348 0.000908 ***
## unit_idSheridan-Kalorama near          -3.140e-03  1.433e-03  -2.191 0.029124 *  
## unit_idSixteenth St hd                  1.453e-02  1.482e-03   9.809  < 2e-16 ***
## unit_idSixteenth St near               -1.051e-03  1.442e-03  -0.729 0.466709    
## unit_idStrivers' Section hd             1.680e-02  1.485e-03  11.314  < 2e-16 ***
## unit_idStrivers' Section near           4.666e-03  1.433e-03   3.257 0.001244 ** 
## unit_idTakoma Park hd                  -5.322e-03  1.485e-03  -3.585 0.000388 ***
## unit_idTakoma Park near                -9.467e-04  1.433e-03  -0.661 0.509228    
## unit_idWashington Heights hd            9.668e-03  1.507e-03   6.415 4.84e-10 ***
## unit_idWashington Heights near          7.585e-03  1.374e-03   5.520 6.81e-08 ***
## unit_idWoodley Park hd                  4.392e-03  1.493e-03   2.942 0.003491 ** 
## unit_idWoodley Park near                       NA         NA      NA       NA    
## year1970                               -4.015e-03  5.808e-04  -6.913 2.43e-11 ***
## year1980                               -5.327e-03  5.960e-04  -8.939  < 2e-16 ***
## year1990                               -5.449e-03  6.346e-04  -8.586 3.51e-16 ***
## year2000                               -5.586e-03  6.846e-04  -8.160 6.98e-15 ***
## year2010                               -4.828e-03  7.099e-04  -6.801 4.84e-11 ***
## year2020                               -3.960e-03  7.466e-04  -5.305 2.06e-07 ***
## treatment_group:desig_yet              -1.265e-03  5.715e-04  -2.213 0.027591 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.002566 on 333 degrees of freedom
##   (13 observations deleted due to missingness)
## Multiple R-squared:  0.8966, Adjusted R-squared:  0.8752 
## F-statistic: 41.86 on 69 and 333 DF,  p-value: < 2.2e-16
## 
## [1] "__________"
## [1] "Coef. on treatment variable when we add area fixed effects:"
##      Estimate    Std. Error       t value      Pr(>|t|) 
## -0.0012646118  0.0005715057 -2.2127719758  0.0275912563 
## [1] "_______________________________________________________"
## [1] "D-in-D regression for the % of white residents, using population weights"
## 
## Call:
## lm(formula = main_formula, data = comp_df_subset, weights = wt)
## 
## Weighted Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.71659 -0.06635  0.00000  0.05182  0.83441 
## 
## Coefficients: (1 not defined because of singularities)
##                                          Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                             0.0084885  0.0014021   6.054 3.99e-09 ***
## treatment_group                         0.0080029  0.0017284   4.630 5.33e-06 ***
## desig_yet                               0.0014193  0.0005465   2.597 0.009845 ** 
## unit_idAnacostia near                  -0.0004139  0.0016984  -0.244 0.807602    
## unit_idBlagden Alley/Naylor Court hd    0.0022265  0.0030488   0.730 0.465743    
## unit_idBlagden Alley/Naylor Court near  0.0008974  0.0031644   0.284 0.776900    
## unit_idBloomingdale hd                  0.0018487  0.0013439   1.376 0.169912    
## unit_idBloomingdale near                0.0011979  0.0015738   0.761 0.447124    
## unit_idCapitol Hill hd                 -0.0009560  0.0011042  -0.866 0.387269    
## unit_idCapitol Hill near                0.0005424  0.0014074   0.385 0.700192    
## unit_idCleveland Park hd               -0.0060765  0.0013669  -4.445 1.22e-05 ***
## unit_idCleveland Park near             -0.0004137  0.0016160  -0.256 0.798125    
## unit_idDowntown hd                     -0.0025986  0.0025139  -1.034 0.302068    
## unit_idDowntown near                    0.0019836  0.0026484   0.749 0.454431    
## unit_idDupont Circle hd                 0.0064241  0.0011695   5.493 8.13e-08 ***
## unit_idDupont Circle near               0.0006759  0.0014594   0.463 0.643598    
## unit_idFinancial hd                    -0.0065545  0.0058062  -1.129 0.259801    
## unit_idFinancial near                  -0.0034608  0.0058709  -0.589 0.555956    
## unit_idFoggy Bottom hd                  0.0172797  0.0022469   7.690 1.86e-13 ***
## unit_idFoggy Bottom near                0.0048756  0.0024059   2.027 0.043549 *  
## unit_idFoxhall hd                      -0.0021816  0.0028170  -0.774 0.439243    
## unit_idFoxhall near                    -0.0005973  0.0029351  -0.204 0.838864    
## unit_idGeorgetown hd                   -0.0053650  0.0011826  -4.537 8.12e-06 ***
## unit_idGeorgetown near                 -0.0017087  0.0014801  -1.154 0.249188    
## unit_idGreater 14th St hd               0.0091177  0.0012556   7.262 2.98e-12 ***
## unit_idGreater 14th St near             0.0071601  0.0015624   4.583 6.61e-06 ***
## unit_idGreater U St hd                  0.0023042  0.0012578   1.832 0.067898 .  
## unit_idGreater U St near                0.0056772  0.0015165   3.744 0.000215 ***
## unit_idGWU / Old West End hd            0.0112474  0.0017739   6.341 7.87e-10 ***
## unit_idGWU / Old West End near          0.0080330  0.0019498   4.120 4.84e-05 ***
## unit_idKalorama Triangle hd             0.0098166  0.0014306   6.862 3.58e-11 ***
## unit_idKalorama Triangle near           0.0031853  0.0016690   1.909 0.057224 .  
## unit_idKingman Park hd                 -0.0058304  0.0016498  -3.534 0.000470 ***
## unit_idKingman Park near               -0.0008831  0.0018367  -0.481 0.630987    
## unit_idLafayette Square hd             -0.0100373  0.0149453  -0.672 0.502327    
## unit_idLafayette Square near           -0.0019591  0.0149700  -0.131 0.895962    
## unit_idLeDroit Park hd                  0.0008833  0.0020645   0.428 0.669040    
## unit_idLeDroit Park near                0.0033299  0.0022457   1.483 0.139121    
## unit_idLogan Circle hd                  0.0080348  0.0021749   3.694 0.000260 ***
## unit_idLogan Circle near                0.0154412  0.0023456   6.583 1.91e-10 ***
## unit_idMassachusetts Ave hd            -0.0011017  0.0016650  -0.662 0.508666    
## unit_idMassachusetts Ave near          -0.0028922  0.0018825  -1.536 0.125439    
## unit_idMeridian Hill hd                 0.0103651  0.0014918   6.948 2.11e-11 ***
## unit_idMeridian Hill near               0.0181833  0.0016952  10.727  < 2e-16 ***
## unit_idMt. Pleasant hd                  0.0042010  0.0012161   3.455 0.000626 ***
## unit_idMt. Pleasant near                0.0031240  0.0014904   2.096 0.036863 *  
## unit_idMt. Vernon Square hd             0.0004520  0.0019921   0.227 0.820652    
## unit_idMt. Vernon Square near           0.0065476  0.0021638   3.026 0.002681 ** 
## unit_idPennsylvania Ave NHS hd         -0.0093688  0.0022910  -4.089 5.49e-05 ***
## unit_idPennsylvania Ave NHS near       -0.0035210  0.0024475  -1.439 0.151239    
## unit_idShaw hd                          0.0091484  0.0013467   6.793 5.43e-11 ***
## unit_idShaw near                        0.0092808  0.0016552   5.607 4.48e-08 ***
## unit_idSheridan-Kalorama hd            -0.0058600  0.0015884  -3.689 0.000265 ***
## unit_idSheridan-Kalorama near          -0.0023139  0.0018871  -1.226 0.221038    
## unit_idSixteenth St hd                  0.0139789  0.0013758  10.160  < 2e-16 ***
## unit_idSixteenth St near               -0.0003306  0.0016332  -0.202 0.839713    
## unit_idStrivers' Section hd             0.0163657  0.0016053  10.195  < 2e-16 ***
## unit_idStrivers' Section near           0.0053801  0.0018213   2.954 0.003372 ** 
## unit_idTakoma Park hd                  -0.0058231  0.0020778  -2.803 0.005381 ** 
## unit_idTakoma Park near                -0.0002735  0.0022495  -0.122 0.903314    
## unit_idWashington Heights hd            0.0091533  0.0015909   5.754 2.06e-08 ***
## unit_idWashington Heights near          0.0089191  0.0017927   4.975 1.07e-06 ***
## unit_idWoodley Park hd                  0.0038127  0.0016985   2.245 0.025473 *  
## unit_idWoodley Park near                       NA         NA      NA       NA    
## year1970                               -0.0052674  0.0004645 -11.340  < 2e-16 ***
## year1980                               -0.0069791  0.0005429 -12.855  < 2e-16 ***
## year1990                               -0.0071171  0.0005968 -11.926  < 2e-16 ***
## year2000                               -0.0072192  0.0006468 -11.161  < 2e-16 ***
## year2010                               -0.0066617  0.0006507 -10.237  < 2e-16 ***
## year2020                               -0.0056558  0.0006868  -8.236 4.74e-15 ***
## treatment_group:desig_yet              -0.0022210  0.0005341  -4.159 4.12e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.1706 on 317 degrees of freedom
##   (23 observations deleted due to missingness)
## Multiple R-squared:  0.9051, Adjusted R-squared:  0.8845 
## F-statistic: 43.84 on 69 and 317 DF,  p-value: < 2.2e-16
## 
## [1] "__________"
## [1] "Coef. on treatment variable when we add area fixed effects:"
##      Estimate    Std. Error       t value      Pr(>|t|) 
## -0.0022209703  0.0005340506 -4.1587266533  0.0000412437
## 
## Call:
## did::att_gt(yname = dep_var, tname = "year", idname = "unit_id_num", 
##     gname = "first_decade_desig", xformla = ~1, data = comp_df[comp_df$group == 
##         "black" & !is.na(comp_df$n_tot_hd), ], allow_unbalanced_panel = T, 
##     weightsname = "n_tot_hd")
## 
## Reference: Callaway, Brantly and Pedro H.C. Sant'Anna.  "Difference-in-Differences with Multiple Time Periods." Journal of Econometrics, Vol. 225, No. 2, pp. 200-230, 2021. <https://doi.org/10.1016/j.jeconom.2020.12.001>, <https://arxiv.org/abs/1803.09015> 
## 
## Group-Time Average Treatment Effects:
##  Group Time ATT(g,t) Std. Error [95% Simult.  Conf. Band]  
##   1970 1970   0.0022     0.0011       -0.0006      0.0050  
##   1970 1980   0.0028     0.0011        0.0001      0.0054 *
##   1970 1990   0.0031     0.0012        0.0002      0.0060 *
##   1970 2000   0.0036     0.0011        0.0008      0.0065 *
##   1970 2010   0.0031     0.0011        0.0004      0.0058 *
##   1970 2020   0.0019     0.0010       -0.0007      0.0044  
##   1980 1970  -0.0043     0.0034       -0.0127      0.0041  
##   1980 1980  -0.0018     0.0005       -0.0031     -0.0005 *
##   1980 1990  -0.0022     0.0008       -0.0041     -0.0003 *
##   1980 2000  -0.0020     0.0006       -0.0035     -0.0005 *
##   1980 2010  -0.0031     0.0005       -0.0043     -0.0019 *
##   1980 2020  -0.0032     0.0007       -0.0049     -0.0014 *
##   1990 1970  -0.0014     0.0057       -0.0158      0.0129  
##   1990 1980  -0.0003     0.0017       -0.0046      0.0041  
##   1990 1990  -0.0004     0.0011       -0.0032      0.0024  
##   1990 2000   0.0001     0.0016       -0.0038      0.0041  
##   1990 2010  -0.0024     0.0008       -0.0044     -0.0003 *
##   1990 2020  -0.0034     0.0011       -0.0063     -0.0006 *
##   2000 1970  -0.0076     0.0038       -0.0172      0.0019  
##   2000 1980  -0.0043     0.0006       -0.0059     -0.0027 *
##   2000 1990   0.0002     0.0006       -0.0012      0.0016  
##   2000 2000   0.0009     0.0009       -0.0015      0.0032  
##   2000 2010   0.0013     0.0014       -0.0023      0.0048  
##   2000 2020   0.0026     0.0015       -0.0011      0.0062  
##   2010 1970       NA         NA            NA          NA  
##   2010 1980  -0.0052     0.0010       -0.0076     -0.0027 *
##   2010 1990   0.0002     0.0007       -0.0015      0.0019  
##   2010 2000  -0.0009     0.0004       -0.0020      0.0001  
##   2010 2010  -0.0003     0.0002       -0.0009      0.0002  
##   2010 2020   0.0006     0.0008       -0.0015      0.0026  
##   2020 1970  -0.0014     0.0050       -0.0138      0.0110  
##   2020 1980  -0.0010     0.0033       -0.0092      0.0071  
##   2020 1990  -0.0017     0.0021       -0.0069      0.0034  
##   2020 2000  -0.0006     0.0004       -0.0017      0.0005  
##   2020 2010   0.0043     0.0039       -0.0056      0.0141  
##   2020 2020  -0.0004     0.0012       -0.0033      0.0025  
## ---
## Signif. codes: `*' confidence band does not cover 0
## 
## P-value for pre-test of parallel trends assumption:  0
## Control Group:  Never Treated,  Anticipation Periods:  0
## Estimation Method:  Doubly Robust
## NULL
## 
## Call:
## aggte(MP = hd.attgt, type = "group", na.rm = T)
## 
## Reference: Callaway, Brantly and Pedro H.C. Sant'Anna.  "Difference-in-Differences with Multiple Time Periods." Journal of Econometrics, Vol. 225, No. 2, pp. 200-230, 2021. <https://doi.org/10.1016/j.jeconom.2020.12.001>, <https://arxiv.org/abs/1803.09015> 
## 
## 
## Overall summary of ATT's based on group/cohort aggregation:  
##     ATT    Std. Error     [ 95%  Conf. Int.] 
##  -7e-04         6e-04    -0.0019       4e-04 
## 
## 
## Group Effects:
##  Group Estimate Std. Error [95% Simult.  Conf. Band]  
##   1970   0.0028     0.0011        0.0003      0.0053 *
##   1980  -0.0025     0.0005       -0.0037     -0.0012 *
##   1990  -0.0015     0.0009       -0.0036      0.0005  
##   2000   0.0016     0.0010       -0.0007      0.0039  
##   2010   0.0001     0.0004       -0.0009      0.0011  
##   2020  -0.0004     0.0011       -0.0029      0.0021  
## ---
## Signif. codes: `*' confidence band does not cover 0
## 
## Control Group:  Never Treated,  Anticipation Periods:  0
## Estimation Method:  Doubly Robust
## NULL
rv$lineplots$pop_dens

rv <- run_all(mp=.25, buff_dist=.005, threshold=.1, dep_var = "pop_dens")
## [1] "_______________________________________________________"
## [1] "D-in-D regression for the % of black residents, unweighted"
## 
## Call:
## lm(formula = main_formula, data = comp_df_subset, weights = wt)
## 
## Residuals:
##        Min         1Q     Median         3Q        Max 
## -0.0090950 -0.0010291 -0.0000308  0.0008752  0.0112893 
## 
## Coefficients: (1 not defined because of singularities)
##                                          Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                             6.370e-03  9.846e-04   6.469 3.43e-10 ***
## treatment_group                         7.538e-03  1.397e-03   5.394 1.29e-07 ***
## desig_yet                               9.837e-04  5.150e-04   1.910 0.056952 .  
## unit_idAnacostia near                   1.179e-03  1.301e-03   0.906 0.365398    
## unit_idBlagden Alley/Naylor Court hd    2.010e-03  1.407e-03   1.429 0.153873    
## unit_idBlagden Alley/Naylor Court near  5.731e-03  1.292e-03   4.434 1.25e-05 ***
## unit_idBloomingdale hd                  2.717e-03  1.387e-03   1.959 0.050915 .  
## unit_idBloomingdale near                2.043e-03  1.301e-03   1.570 0.117229    
## unit_idCapitol Hill hd                 -2.042e-04  1.347e-03  -0.152 0.879629    
## unit_idCapitol Hill near                2.260e-03  1.301e-03   1.737 0.083239 .  
## unit_idCleveland Park hd               -5.226e-03  1.351e-03  -3.868 0.000132 ***
## unit_idCleveland Park near              4.573e-04  1.295e-03   0.353 0.724111    
## unit_idDowntown hd                     -3.555e-03  1.420e-03  -2.503 0.012765 *  
## unit_idDowntown near                   -5.250e-05  1.295e-03  -0.041 0.967674    
## unit_idDupont Circle hd                 6.673e-03  1.347e-03   4.953 1.15e-06 ***
## unit_idDupont Circle near               2.091e-03  1.301e-03   1.608 0.108809    
## unit_idFinancial hd                    -7.803e-03  1.399e-03  -5.579 4.94e-08 ***
## unit_idFinancial near                   3.640e-04  1.349e-03   0.270 0.787512    
## unit_idFoggy Bottom hd                  1.679e-02  1.399e-03  12.003  < 2e-16 ***
## unit_idFoggy Bottom near                3.400e-03  1.295e-03   2.627 0.009011 ** 
## unit_idFoxhall hd                      -1.463e-03  1.420e-03  -1.030 0.303652    
## unit_idFoxhall near                    -2.606e-04  1.295e-03  -0.201 0.840560    
## unit_idGeorgetown hd                   -4.669e-03  1.347e-03  -3.465 0.000598 ***
## unit_idGeorgetown near                 -2.382e-04  1.311e-03  -0.182 0.855927    
## unit_idGreater 14th St hd               9.108e-03  1.359e-03   6.701 8.56e-11 ***
## unit_idGreater 14th St near             5.674e-03  1.347e-03   4.214 3.22e-05 ***
## unit_idGreater U St hd                  2.899e-03  1.359e-03   2.133 0.033665 *  
## unit_idGreater U St near                8.180e-03  1.292e-03   6.329 7.76e-10 ***
## unit_idGWU / Old West End hd            8.667e-03  1.438e-03   6.026 4.37e-09 ***
## unit_idGWU / Old West End near          2.201e-03  1.301e-03   1.692 0.091598 .  
## unit_idKalorama Triangle hd             9.486e-03  1.351e-03   7.021 1.20e-11 ***
## unit_idKalorama Triangle near           3.689e-03  1.295e-03   2.850 0.004639 ** 
## unit_idKingman Park hd                 -5.168e-03  1.438e-03  -3.593 0.000375 ***
## unit_idKingman Park near                7.630e-04  1.301e-03   0.587 0.557908    
## unit_idLafayette Square hd             -8.609e-03  1.396e-03  -6.167 1.97e-09 ***
## unit_idLafayette Square near           -6.258e-04  1.301e-03  -0.481 0.630780    
## unit_idLeDroit Park hd                  9.975e-04  1.396e-03   0.715 0.475382    
## unit_idLeDroit Park near                3.065e-03  1.301e-03   2.356 0.019022 *  
## unit_idLogan Circle hd                  8.425e-03  1.396e-03   6.035 4.14e-09 ***
## unit_idLogan Circle near                6.110e-03  1.358e-03   4.500 9.32e-06 ***
## unit_idMassachusetts Ave hd            -5.967e-04  1.396e-03  -0.427 0.669318    
## unit_idMassachusetts Ave near           9.124e-06  1.301e-03   0.007 0.994407    
## unit_idMeridian Hill hd                 1.092e-02  1.438e-03   7.591 3.06e-13 ***
## unit_idMeridian Hill near               1.435e-02  1.301e-03  11.032  < 2e-16 ***
## unit_idMt. Pleasant hd                  4.889e-03  1.351e-03   3.618 0.000342 ***
## unit_idMt. Pleasant near                4.793e-03  1.295e-03   3.703 0.000249 ***
## unit_idMt. Vernon Square hd             7.582e-04  1.407e-03   0.539 0.590274    
## unit_idMt. Vernon Square near           4.698e-03  1.292e-03   3.635 0.000321 ***
## unit_idPennsylvania Ave NHS hd         -8.510e-03  1.359e-03  -6.261 1.15e-09 ***
## unit_idPennsylvania Ave NHS near       -1.484e-03  1.292e-03  -1.148 0.251682    
## unit_idShaw hd                          8.787e-03  1.359e-03   6.465 3.50e-10 ***
## unit_idShaw near                        4.148e-03  1.292e-03   3.209 0.001457 ** 
## unit_idSheridan-Kalorama hd            -4.778e-03  1.351e-03  -3.536 0.000462 ***
## unit_idSheridan-Kalorama near           9.106e-04  1.295e-03   0.703 0.482271    
## unit_idSixteenth St hd                  1.453e-02  1.396e-03  10.410  < 2e-16 ***
## unit_idSixteenth St near                7.540e-03  1.301e-03   5.797 1.54e-08 ***
## unit_idStrivers' Section hd             1.680e-02  1.399e-03  12.012  < 2e-16 ***
## unit_idStrivers' Section near           1.609e-02  1.349e-03  11.924  < 2e-16 ***
## unit_idTakoma Park hd                  -5.316e-03  1.399e-03  -3.801 0.000171 ***
## unit_idTakoma Park near                 6.329e-04  1.295e-03   0.489 0.625232    
## unit_idWashington Heights hd            9.685e-03  1.420e-03   6.820 4.15e-11 ***
## unit_idWashington Heights near          4.593e-03  1.295e-03   3.548 0.000442 ***
## unit_idWoodley Park hd                  4.403e-03  1.407e-03   3.130 0.001897 ** 
## unit_idWoodley Park near                       NA         NA      NA       NA    
## year1970                               -3.632e-03  5.067e-04  -7.168 4.75e-12 ***
## year1980                               -5.399e-03  5.228e-04 -10.326  < 2e-16 ***
## year1990                               -5.516e-03  5.622e-04  -9.811  < 2e-16 ***
## year2000                               -5.521e-03  6.124e-04  -9.016  < 2e-16 ***
## year2010                               -4.696e-03  6.375e-04  -7.367 1.33e-12 ***
## year2020                               -3.779e-03  6.738e-04  -5.608 4.23e-08 ***
## treatment_group:desig_yet              -1.423e-03  5.329e-04  -2.670 0.007943 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.002418 on 341 degrees of freedom
##   (17 observations deleted due to missingness)
## Multiple R-squared:  0.899,  Adjusted R-squared:  0.8785 
## F-statistic: 43.98 on 69 and 341 DF,  p-value: < 2.2e-16
## 
## [1] "__________"
## [1] "Coef. on treatment variable when we add area fixed effects:"
##      Estimate    Std. Error       t value      Pr(>|t|) 
## -0.0014230184  0.0005329172 -2.6702428456  0.0079426789 
## [1] "_______________________________________________________"
## [1] "D-in-D regression for the % of black residents, using population weights"
## 
## Call:
## lm(formula = main_formula, data = comp_df_subset, weights = wt)
## 
## Weighted Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.68291 -0.06289  0.00000  0.05147  0.87834 
## 
## Coefficients: (1 not defined because of singularities)
##                                          Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                             0.0078706  0.0013939   5.646 3.63e-08 ***
## treatment_group                         0.0082202  0.0017218   4.774 2.75e-06 ***
## desig_yet                               0.0017543  0.0005445   3.222 0.001403 ** 
## unit_idAnacostia near                   0.0009827  0.0016923   0.581 0.561887    
## unit_idBlagden Alley/Naylor Court hd    0.0021836  0.0030379   0.719 0.472812    
## unit_idBlagden Alley/Naylor Court near  0.0054561  0.0031532   1.730 0.084532 .  
## unit_idBloomingdale hd                  0.0019045  0.0013391   1.422 0.155930    
## unit_idBloomingdale near                0.0011130  0.0015680   0.710 0.478356    
## unit_idCapitol Hill hd                 -0.0008680  0.0011003  -0.789 0.430733    
## unit_idCapitol Hill near                0.0013071  0.0014023   0.932 0.351981    
## unit_idCleveland Park hd               -0.0059957  0.0013621  -4.402 1.47e-05 ***
## unit_idCleveland Park near             -0.0004375  0.0016102  -0.272 0.786019    
## unit_idDowntown hd                     -0.0025852  0.0025050  -1.032 0.302845    
## unit_idDowntown near                    0.0005634  0.0026390   0.214 0.831070    
## unit_idDupont Circle hd                 0.0065222  0.0011653   5.597 4.70e-08 ***
## unit_idDupont Circle near               0.0010969  0.0014541   0.754 0.451183    
## unit_idFinancial hd                    -0.0065578  0.0057856  -1.133 0.257868    
## unit_idFinancial near                  -0.0010744  0.0058501  -0.184 0.854405    
## unit_idFoggy Bottom hd                  0.0172755  0.0022389   7.716 1.55e-13 ***
## unit_idFoggy Bottom near                0.0026739  0.0023974   1.115 0.265534    
## unit_idFoxhall hd                      -0.0021901  0.0028070  -0.780 0.435832    
## unit_idFoxhall near                    -0.0008082  0.0029247  -0.276 0.782466    
## unit_idGeorgetown hd                   -0.0052760  0.0011783  -4.478 1.05e-05 ***
## unit_idGeorgetown near                 -0.0012430  0.0014749  -0.843 0.399992    
## unit_idGreater 14th St hd               0.0092057  0.0012511   7.358 1.59e-12 ***
## unit_idGreater 14th St near             0.0051086  0.0015568   3.281 0.001147 ** 
## unit_idGreater U St hd                  0.0023531  0.0012533   1.878 0.061358 .  
## unit_idGreater U St near                0.0073879  0.0015110   4.889 1.61e-06 ***
## unit_idGWU / Old West End hd            0.0112234  0.0017674   6.350 7.40e-10 ***
## unit_idGWU / Old West End near          0.0017564  0.0019429   0.904 0.366664    
## unit_idKalorama Triangle hd             0.0099241  0.0014255   6.962 1.92e-11 ***
## unit_idKalorama Triangle near           0.0032246  0.0016629   1.939 0.053371 .  
## unit_idKingman Park hd                 -0.0058721  0.0016438  -3.572 0.000408 ***
## unit_idKingman Park near                0.0006907  0.0018301   0.377 0.706120    
## unit_idLafayette Square hd             -0.0102069  0.0148923  -0.685 0.493603    
## unit_idLafayette Square near           -0.0009343  0.0149169  -0.063 0.950099    
## unit_idLeDroit Park hd                  0.0009364  0.0020572   0.455 0.649293    
## unit_idLeDroit Park near                0.0023827  0.0022377   1.065 0.287777    
## unit_idLogan Circle hd                  0.0080502  0.0021672   3.715 0.000240 ***
## unit_idLogan Circle near                0.0053033  0.0023373   2.269 0.023934 *  
## unit_idMassachusetts Ave hd            -0.0010990  0.0016591  -0.662 0.508209    
## unit_idMassachusetts Ave near          -0.0011305  0.0018758  -0.603 0.547149    
## unit_idMeridian Hill hd                 0.0103277  0.0014862   6.949 2.08e-11 ***
## unit_idMeridian Hill near               0.0144147  0.0016892   8.534 5.83e-16 ***
## unit_idMt. Pleasant hd                  0.0042900  0.0012117   3.540 0.000459 ***
## unit_idMt. Pleasant near                0.0037904  0.0014850   2.552 0.011163 *  
## unit_idMt. Vernon Square hd             0.0004219  0.0019850   0.213 0.831800    
## unit_idMt. Vernon Square near           0.0048412  0.0021561   2.245 0.025431 *  
## unit_idPennsylvania Ave NHS hd         -0.0092759  0.0022829  -4.063 6.10e-05 ***
## unit_idPennsylvania Ave NHS near       -0.0027997  0.0024388  -1.148 0.251822    
## unit_idShaw hd                          0.0092315  0.0013419   6.879 3.19e-11 ***
## unit_idShaw near                        0.0031596  0.0015865   1.992 0.047275 *  
## unit_idSheridan-Kalorama hd            -0.0057824  0.0015828  -3.653 0.000302 ***
## unit_idSheridan-Kalorama near           0.0001832  0.0017999   0.102 0.918977    
## unit_idSixteenth St hd                  0.0140005  0.0013710  10.212  < 2e-16 ***
## unit_idSixteenth St near                0.0055748  0.0016274   3.426 0.000694 ***
## unit_idStrivers' Section hd             0.0163660  0.0015996  10.231  < 2e-16 ***
## unit_idStrivers' Section near           0.0153285  0.0018149   8.446 1.08e-15 ***
## unit_idTakoma Park hd                  -0.0058248  0.0020704  -2.813 0.005206 ** 
## unit_idTakoma Park near                 0.0003225  0.0022416   0.144 0.885686    
## unit_idWashington Heights hd            0.0091258  0.0015851   5.757 2.01e-08 ***
## unit_idWashington Heights near          0.0035618  0.0017863   1.994 0.047010 *  
## unit_idWoodley Park hd                  0.0038056  0.0016924   2.249 0.025219 *  
## unit_idWoodley Park near                       NA         NA      NA       NA    
## year1970                               -0.0045647  0.0004559 -10.012  < 2e-16 ***
## year1980                               -0.0066381  0.0005340 -12.432  < 2e-16 ***
## year1990                               -0.0068391  0.0005877 -11.637  < 2e-16 ***
## year2000                               -0.0068358  0.0006375 -10.723  < 2e-16 ***
## year2010                               -0.0062937  0.0006413  -9.814  < 2e-16 ***
## year2020                               -0.0051085  0.0006772  -7.544 4.79e-13 ***
## treatment_group:desig_yet              -0.0026316  0.0005296  -4.969 1.10e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.17 on 319 degrees of freedom
##   (33 observations deleted due to missingness)
## Multiple R-squared:  0.8982, Adjusted R-squared:  0.8761 
## F-statistic: 40.78 on 69 and 319 DF,  p-value: < 2.2e-16
## 
## [1] "__________"
## [1] "Coef. on treatment variable when we add area fixed effects:"
##      Estimate    Std. Error       t value      Pr(>|t|) 
## -2.631591e-03  5.295657e-04 -4.969338e+00  1.098028e-06 
## [1] "_______________________________________________________"
## [1] "D-in-D regression for the % of white residents, unweighted"
## 
## Call:
## lm(formula = main_formula, data = comp_df_subset, weights = wt)
## 
## Residuals:
##        Min         1Q     Median         3Q        Max 
## -0.0090950 -0.0010291 -0.0000308  0.0008752  0.0112893 
## 
## Coefficients: (1 not defined because of singularities)
##                                          Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                             6.370e-03  9.846e-04   6.469 3.43e-10 ***
## treatment_group                         7.538e-03  1.397e-03   5.394 1.29e-07 ***
## desig_yet                               9.837e-04  5.150e-04   1.910 0.056952 .  
## unit_idAnacostia near                   1.179e-03  1.301e-03   0.906 0.365398    
## unit_idBlagden Alley/Naylor Court hd    2.010e-03  1.407e-03   1.429 0.153873    
## unit_idBlagden Alley/Naylor Court near  5.731e-03  1.292e-03   4.434 1.25e-05 ***
## unit_idBloomingdale hd                  2.717e-03  1.387e-03   1.959 0.050915 .  
## unit_idBloomingdale near                2.043e-03  1.301e-03   1.570 0.117229    
## unit_idCapitol Hill hd                 -2.042e-04  1.347e-03  -0.152 0.879629    
## unit_idCapitol Hill near                2.260e-03  1.301e-03   1.737 0.083239 .  
## unit_idCleveland Park hd               -5.226e-03  1.351e-03  -3.868 0.000132 ***
## unit_idCleveland Park near              4.573e-04  1.295e-03   0.353 0.724111    
## unit_idDowntown hd                     -3.555e-03  1.420e-03  -2.503 0.012765 *  
## unit_idDowntown near                   -5.250e-05  1.295e-03  -0.041 0.967674    
## unit_idDupont Circle hd                 6.673e-03  1.347e-03   4.953 1.15e-06 ***
## unit_idDupont Circle near               2.091e-03  1.301e-03   1.608 0.108809    
## unit_idFinancial hd                    -7.803e-03  1.399e-03  -5.579 4.94e-08 ***
## unit_idFinancial near                   3.640e-04  1.349e-03   0.270 0.787512    
## unit_idFoggy Bottom hd                  1.679e-02  1.399e-03  12.003  < 2e-16 ***
## unit_idFoggy Bottom near                3.400e-03  1.295e-03   2.627 0.009011 ** 
## unit_idFoxhall hd                      -1.463e-03  1.420e-03  -1.030 0.303652    
## unit_idFoxhall near                    -2.606e-04  1.295e-03  -0.201 0.840560    
## unit_idGeorgetown hd                   -4.669e-03  1.347e-03  -3.465 0.000598 ***
## unit_idGeorgetown near                 -2.382e-04  1.311e-03  -0.182 0.855927    
## unit_idGreater 14th St hd               9.108e-03  1.359e-03   6.701 8.56e-11 ***
## unit_idGreater 14th St near             5.674e-03  1.347e-03   4.214 3.22e-05 ***
## unit_idGreater U St hd                  2.899e-03  1.359e-03   2.133 0.033665 *  
## unit_idGreater U St near                8.180e-03  1.292e-03   6.329 7.76e-10 ***
## unit_idGWU / Old West End hd            8.667e-03  1.438e-03   6.026 4.37e-09 ***
## unit_idGWU / Old West End near          2.201e-03  1.301e-03   1.692 0.091598 .  
## unit_idKalorama Triangle hd             9.486e-03  1.351e-03   7.021 1.20e-11 ***
## unit_idKalorama Triangle near           3.689e-03  1.295e-03   2.850 0.004639 ** 
## unit_idKingman Park hd                 -5.168e-03  1.438e-03  -3.593 0.000375 ***
## unit_idKingman Park near                7.630e-04  1.301e-03   0.587 0.557908    
## unit_idLafayette Square hd             -8.609e-03  1.396e-03  -6.167 1.97e-09 ***
## unit_idLafayette Square near           -6.258e-04  1.301e-03  -0.481 0.630780    
## unit_idLeDroit Park hd                  9.975e-04  1.396e-03   0.715 0.475382    
## unit_idLeDroit Park near                3.065e-03  1.301e-03   2.356 0.019022 *  
## unit_idLogan Circle hd                  8.425e-03  1.396e-03   6.035 4.14e-09 ***
## unit_idLogan Circle near                6.110e-03  1.358e-03   4.500 9.32e-06 ***
## unit_idMassachusetts Ave hd            -5.967e-04  1.396e-03  -0.427 0.669318    
## unit_idMassachusetts Ave near           9.124e-06  1.301e-03   0.007 0.994407    
## unit_idMeridian Hill hd                 1.092e-02  1.438e-03   7.591 3.06e-13 ***
## unit_idMeridian Hill near               1.435e-02  1.301e-03  11.032  < 2e-16 ***
## unit_idMt. Pleasant hd                  4.889e-03  1.351e-03   3.618 0.000342 ***
## unit_idMt. Pleasant near                4.793e-03  1.295e-03   3.703 0.000249 ***
## unit_idMt. Vernon Square hd             7.582e-04  1.407e-03   0.539 0.590274    
## unit_idMt. Vernon Square near           4.698e-03  1.292e-03   3.635 0.000321 ***
## unit_idPennsylvania Ave NHS hd         -8.510e-03  1.359e-03  -6.261 1.15e-09 ***
## unit_idPennsylvania Ave NHS near       -1.484e-03  1.292e-03  -1.148 0.251682    
## unit_idShaw hd                          8.787e-03  1.359e-03   6.465 3.50e-10 ***
## unit_idShaw near                        4.148e-03  1.292e-03   3.209 0.001457 ** 
## unit_idSheridan-Kalorama hd            -4.778e-03  1.351e-03  -3.536 0.000462 ***
## unit_idSheridan-Kalorama near           9.106e-04  1.295e-03   0.703 0.482271    
## unit_idSixteenth St hd                  1.453e-02  1.396e-03  10.410  < 2e-16 ***
## unit_idSixteenth St near                7.540e-03  1.301e-03   5.797 1.54e-08 ***
## unit_idStrivers' Section hd             1.680e-02  1.399e-03  12.012  < 2e-16 ***
## unit_idStrivers' Section near           1.609e-02  1.349e-03  11.924  < 2e-16 ***
## unit_idTakoma Park hd                  -5.316e-03  1.399e-03  -3.801 0.000171 ***
## unit_idTakoma Park near                 6.329e-04  1.295e-03   0.489 0.625232    
## unit_idWashington Heights hd            9.685e-03  1.420e-03   6.820 4.15e-11 ***
## unit_idWashington Heights near          4.593e-03  1.295e-03   3.548 0.000442 ***
## unit_idWoodley Park hd                  4.403e-03  1.407e-03   3.130 0.001897 ** 
## unit_idWoodley Park near                       NA         NA      NA       NA    
## year1970                               -3.632e-03  5.067e-04  -7.168 4.75e-12 ***
## year1980                               -5.399e-03  5.228e-04 -10.326  < 2e-16 ***
## year1990                               -5.516e-03  5.622e-04  -9.811  < 2e-16 ***
## year2000                               -5.521e-03  6.124e-04  -9.016  < 2e-16 ***
## year2010                               -4.696e-03  6.375e-04  -7.367 1.33e-12 ***
## year2020                               -3.779e-03  6.738e-04  -5.608 4.23e-08 ***
## treatment_group:desig_yet              -1.423e-03  5.329e-04  -2.670 0.007943 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.002418 on 341 degrees of freedom
##   (17 observations deleted due to missingness)
## Multiple R-squared:  0.899,  Adjusted R-squared:  0.8785 
## F-statistic: 43.98 on 69 and 341 DF,  p-value: < 2.2e-16
## 
## [1] "__________"
## [1] "Coef. on treatment variable when we add area fixed effects:"
##      Estimate    Std. Error       t value      Pr(>|t|) 
## -0.0014230184  0.0005329172 -2.6702428456  0.0079426789 
## [1] "_______________________________________________________"
## [1] "D-in-D regression for the % of white residents, using population weights"
## 
## Call:
## lm(formula = main_formula, data = comp_df_subset, weights = wt)
## 
## Weighted Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.68291 -0.06289  0.00000  0.05147  0.87834 
## 
## Coefficients: (1 not defined because of singularities)
##                                          Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                             0.0078706  0.0013939   5.646 3.63e-08 ***
## treatment_group                         0.0082202  0.0017218   4.774 2.75e-06 ***
## desig_yet                               0.0017543  0.0005445   3.222 0.001403 ** 
## unit_idAnacostia near                   0.0009827  0.0016923   0.581 0.561887    
## unit_idBlagden Alley/Naylor Court hd    0.0021836  0.0030379   0.719 0.472812    
## unit_idBlagden Alley/Naylor Court near  0.0054561  0.0031532   1.730 0.084532 .  
## unit_idBloomingdale hd                  0.0019045  0.0013391   1.422 0.155930    
## unit_idBloomingdale near                0.0011130  0.0015680   0.710 0.478356    
## unit_idCapitol Hill hd                 -0.0008680  0.0011003  -0.789 0.430733    
## unit_idCapitol Hill near                0.0013071  0.0014023   0.932 0.351981    
## unit_idCleveland Park hd               -0.0059957  0.0013621  -4.402 1.47e-05 ***
## unit_idCleveland Park near             -0.0004375  0.0016102  -0.272 0.786019    
## unit_idDowntown hd                     -0.0025852  0.0025050  -1.032 0.302845    
## unit_idDowntown near                    0.0005634  0.0026390   0.214 0.831070    
## unit_idDupont Circle hd                 0.0065222  0.0011653   5.597 4.70e-08 ***
## unit_idDupont Circle near               0.0010969  0.0014541   0.754 0.451183    
## unit_idFinancial hd                    -0.0065578  0.0057856  -1.133 0.257868    
## unit_idFinancial near                  -0.0010744  0.0058501  -0.184 0.854405    
## unit_idFoggy Bottom hd                  0.0172755  0.0022389   7.716 1.55e-13 ***
## unit_idFoggy Bottom near                0.0026739  0.0023974   1.115 0.265534    
## unit_idFoxhall hd                      -0.0021901  0.0028070  -0.780 0.435832    
## unit_idFoxhall near                    -0.0008082  0.0029247  -0.276 0.782466    
## unit_idGeorgetown hd                   -0.0052760  0.0011783  -4.478 1.05e-05 ***
## unit_idGeorgetown near                 -0.0012430  0.0014749  -0.843 0.399992    
## unit_idGreater 14th St hd               0.0092057  0.0012511   7.358 1.59e-12 ***
## unit_idGreater 14th St near             0.0051086  0.0015568   3.281 0.001147 ** 
## unit_idGreater U St hd                  0.0023531  0.0012533   1.878 0.061358 .  
## unit_idGreater U St near                0.0073879  0.0015110   4.889 1.61e-06 ***
## unit_idGWU / Old West End hd            0.0112234  0.0017674   6.350 7.40e-10 ***
## unit_idGWU / Old West End near          0.0017564  0.0019429   0.904 0.366664    
## unit_idKalorama Triangle hd             0.0099241  0.0014255   6.962 1.92e-11 ***
## unit_idKalorama Triangle near           0.0032246  0.0016629   1.939 0.053371 .  
## unit_idKingman Park hd                 -0.0058721  0.0016438  -3.572 0.000408 ***
## unit_idKingman Park near                0.0006907  0.0018301   0.377 0.706120    
## unit_idLafayette Square hd             -0.0102069  0.0148923  -0.685 0.493603    
## unit_idLafayette Square near           -0.0009343  0.0149169  -0.063 0.950099    
## unit_idLeDroit Park hd                  0.0009364  0.0020572   0.455 0.649293    
## unit_idLeDroit Park near                0.0023827  0.0022377   1.065 0.287777    
## unit_idLogan Circle hd                  0.0080502  0.0021672   3.715 0.000240 ***
## unit_idLogan Circle near                0.0053033  0.0023373   2.269 0.023934 *  
## unit_idMassachusetts Ave hd            -0.0010990  0.0016591  -0.662 0.508209    
## unit_idMassachusetts Ave near          -0.0011305  0.0018758  -0.603 0.547149    
## unit_idMeridian Hill hd                 0.0103277  0.0014862   6.949 2.08e-11 ***
## unit_idMeridian Hill near               0.0144147  0.0016892   8.534 5.83e-16 ***
## unit_idMt. Pleasant hd                  0.0042900  0.0012117   3.540 0.000459 ***
## unit_idMt. Pleasant near                0.0037904  0.0014850   2.552 0.011163 *  
## unit_idMt. Vernon Square hd             0.0004219  0.0019850   0.213 0.831800    
## unit_idMt. Vernon Square near           0.0048412  0.0021561   2.245 0.025431 *  
## unit_idPennsylvania Ave NHS hd         -0.0092759  0.0022829  -4.063 6.10e-05 ***
## unit_idPennsylvania Ave NHS near       -0.0027997  0.0024388  -1.148 0.251822    
## unit_idShaw hd                          0.0092315  0.0013419   6.879 3.19e-11 ***
## unit_idShaw near                        0.0031596  0.0015865   1.992 0.047275 *  
## unit_idSheridan-Kalorama hd            -0.0057824  0.0015828  -3.653 0.000302 ***
## unit_idSheridan-Kalorama near           0.0001832  0.0017999   0.102 0.918977    
## unit_idSixteenth St hd                  0.0140005  0.0013710  10.212  < 2e-16 ***
## unit_idSixteenth St near                0.0055748  0.0016274   3.426 0.000694 ***
## unit_idStrivers' Section hd             0.0163660  0.0015996  10.231  < 2e-16 ***
## unit_idStrivers' Section near           0.0153285  0.0018149   8.446 1.08e-15 ***
## unit_idTakoma Park hd                  -0.0058248  0.0020704  -2.813 0.005206 ** 
## unit_idTakoma Park near                 0.0003225  0.0022416   0.144 0.885686    
## unit_idWashington Heights hd            0.0091258  0.0015851   5.757 2.01e-08 ***
## unit_idWashington Heights near          0.0035618  0.0017863   1.994 0.047010 *  
## unit_idWoodley Park hd                  0.0038056  0.0016924   2.249 0.025219 *  
## unit_idWoodley Park near                       NA         NA      NA       NA    
## year1970                               -0.0045647  0.0004559 -10.012  < 2e-16 ***
## year1980                               -0.0066381  0.0005340 -12.432  < 2e-16 ***
## year1990                               -0.0068391  0.0005877 -11.637  < 2e-16 ***
## year2000                               -0.0068358  0.0006375 -10.723  < 2e-16 ***
## year2010                               -0.0062937  0.0006413  -9.814  < 2e-16 ***
## year2020                               -0.0051085  0.0006772  -7.544 4.79e-13 ***
## treatment_group:desig_yet              -0.0026316  0.0005296  -4.969 1.10e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.17 on 319 degrees of freedom
##   (33 observations deleted due to missingness)
## Multiple R-squared:  0.8982, Adjusted R-squared:  0.8761 
## F-statistic: 40.78 on 69 and 319 DF,  p-value: < 2.2e-16
## 
## [1] "__________"
## [1] "Coef. on treatment variable when we add area fixed effects:"
##      Estimate    Std. Error       t value      Pr(>|t|) 
## -2.631591e-03  5.295657e-04 -4.969338e+00  1.098028e-06
## 
## Call:
## did::att_gt(yname = dep_var, tname = "year", idname = "unit_id_num", 
##     gname = "first_decade_desig", xformla = ~1, data = comp_df[comp_df$group == 
##         "black" & !is.na(comp_df$n_tot_hd), ], allow_unbalanced_panel = T, 
##     weightsname = "n_tot_hd")
## 
## Reference: Callaway, Brantly and Pedro H.C. Sant'Anna.  "Difference-in-Differences with Multiple Time Periods." Journal of Econometrics, Vol. 225, No. 2, pp. 200-230, 2021. <https://doi.org/10.1016/j.jeconom.2020.12.001>, <https://arxiv.org/abs/1803.09015> 
## 
## Group-Time Average Treatment Effects:
##  Group Time ATT(g,t) Std. Error [95% Simult.  Conf. Band]  
##   1970 1970   0.0013     0.0008       -0.0008      0.0033  
##   1970 1980   0.0024     0.0008        0.0004      0.0045 *
##   1970 1990   0.0029     0.0009        0.0005      0.0052 *
##   1970 2000   0.0033     0.0009        0.0009      0.0056 *
##   1970 2010   0.0029     0.0010        0.0004      0.0054 *
##   1970 2020   0.0013     0.0009       -0.0009      0.0034  
##   1980 1970  -0.0052     0.0032       -0.0131      0.0028  
##   1980 1980  -0.0013     0.0005       -0.0024     -0.0001 *
##   1980 1990  -0.0015     0.0007       -0.0033      0.0003  
##   1980 2000  -0.0015     0.0006       -0.0030      0.0000 *
##   1980 2010  -0.0024     0.0006       -0.0038     -0.0010 *
##   1980 2020  -0.0029     0.0007       -0.0046     -0.0012 *
##   1990 1970  -0.0023     0.0052       -0.0153      0.0107  
##   1990 1980   0.0003     0.0017       -0.0040      0.0046  
##   1990 1990  -0.0003     0.0011       -0.0030      0.0025  
##   1990 2000   0.0001     0.0014       -0.0034      0.0036  
##   1990 2010  -0.0022     0.0008       -0.0042     -0.0002 *
##   1990 2020  -0.0037     0.0010       -0.0061     -0.0013 *
##   2000 1970  -0.0085     0.0039       -0.0182      0.0012  
##   2000 1980  -0.0037     0.0006       -0.0052     -0.0022 *
##   2000 1990   0.0003     0.0005       -0.0009      0.0016  
##   2000 2000   0.0007     0.0008       -0.0013      0.0027  
##   2000 2010   0.0013     0.0013       -0.0021      0.0047  
##   2000 2020   0.0022     0.0014       -0.0013      0.0057  
##   2010 1970       NA         NA            NA          NA  
##   2010 1980  -0.0046     0.0011       -0.0074     -0.0018 *
##   2010 1990   0.0003     0.0010       -0.0021      0.0028  
##   2010 2000  -0.0011     0.0004       -0.0022      0.0000 *
##   2010 2010  -0.0001     0.0002       -0.0008      0.0005  
##   2010 2020   0.0003     0.0008       -0.0017      0.0023  
##   2020 1970  -0.0023     0.0030       -0.0098      0.0052  
##   2020 1980  -0.0005     0.0023       -0.0062      0.0053  
##   2020 1990  -0.0016     0.0019       -0.0063      0.0031  
##   2020 2000  -0.0008     0.0003       -0.0016      0.0001  
##   2020 2010   0.0045     0.0035       -0.0044      0.0134  
##   2020 2020  -0.0008     0.0009       -0.0031      0.0015  
## ---
## Signif. codes: `*' confidence band does not cover 0
## 
## P-value for pre-test of parallel trends assumption:  0
## Control Group:  Never Treated,  Anticipation Periods:  0
## Estimation Method:  Doubly Robust
## NULL
## 
## Call:
## aggte(MP = hd.attgt, type = "group", na.rm = T)
## 
## Reference: Callaway, Brantly and Pedro H.C. Sant'Anna.  "Difference-in-Differences with Multiple Time Periods." Journal of Econometrics, Vol. 225, No. 2, pp. 200-230, 2021. <https://doi.org/10.1016/j.jeconom.2020.12.001>, <https://arxiv.org/abs/1803.09015> 
## 
## 
## Overall summary of ATT's based on group/cohort aggregation:  
##     ATT    Std. Error     [ 95%  Conf. Int.] 
##  -7e-04         5e-04    -0.0016       3e-04 
## 
## 
## Group Effects:
##  Group Estimate Std. Error [95% Simult.  Conf. Band]  
##   1970   0.0023     0.0009        0.0005      0.0042 *
##   1980  -0.0019     0.0005       -0.0030     -0.0008 *
##   1990  -0.0015     0.0009       -0.0034      0.0004  
##   2000   0.0014     0.0011       -0.0009      0.0037  
##   2010   0.0001     0.0004       -0.0008      0.0009  
##   2020  -0.0008     0.0010       -0.0030      0.0013  
## ---
## Signif. codes: `*' confidence band does not cover 0
## 
## Control Group:  Never Treated,  Anticipation Periods:  0
## Estimation Method:  Doubly Robust
## NULL
rv$lineplots$pop_dens

rv <- run_all(mp=.25, buff_dist=.01, threshold=.1, dep_var = "pop_dens")
## [1] "_______________________________________________________"
## [1] "D-in-D regression for the % of black residents, unweighted"
## 
## Call:
## lm(formula = main_formula, data = comp_df_subset, weights = wt)
## 
## Residuals:
##        Min         1Q     Median         3Q        Max 
## -0.0090133 -0.0009280  0.0000887  0.0008235  0.0118304 
## 
## Coefficients: (1 not defined because of singularities)
##                                          Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                             6.163e-03  9.777e-04   6.304 8.88e-10 ***
## treatment_group                         7.149e-03  1.397e-03   5.118 5.15e-07 ***
## desig_yet                               8.041e-04  5.131e-04   1.567 0.118019    
## unit_idAnacostia near                  -6.439e-05  1.300e-03  -0.050 0.960534    
## unit_idBlagden Alley/Naylor Court hd    1.974e-03  1.406e-03   1.404 0.161239    
## unit_idBlagden Alley/Naylor Court near  3.910e-03  1.292e-03   3.026 0.002663 ** 
## unit_idBloomingdale hd                  2.740e-03  1.386e-03   1.976 0.048903 *  
## unit_idBloomingdale near                1.839e-03  1.300e-03   1.414 0.158227    
## unit_idCapitol Hill hd                 -1.192e-04  1.347e-03  -0.088 0.929548    
## unit_idCapitol Hill near                1.480e-03  1.300e-03   1.138 0.255995    
## unit_idCleveland Park hd               -5.156e-03  1.351e-03  -3.817 0.000160 ***
## unit_idCleveland Park near              1.447e-05  1.294e-03   0.011 0.991083    
## unit_idDowntown hd                     -3.609e-03  1.420e-03  -2.542 0.011445 *  
## unit_idDowntown near                   -1.906e-04  1.294e-03  -0.147 0.883021    
## unit_idDupont Circle hd                 6.758e-03  1.347e-03   5.018 8.38e-07 ***
## unit_idDupont Circle near               4.083e-03  1.300e-03   3.140 0.001837 ** 
## unit_idFinancial hd                    -7.821e-03  1.398e-03  -5.594 4.53e-08 ***
## unit_idFinancial near                  -1.447e-03  1.294e-03  -1.118 0.264223    
## unit_idFoggy Bottom hd                  1.677e-02  1.398e-03  11.994  < 2e-16 ***
## unit_idFoggy Bottom near                1.295e-03  1.294e-03   1.000 0.317794    
## unit_idFoxhall hd                      -1.517e-03  1.420e-03  -1.069 0.285959    
## unit_idFoxhall near                     4.403e-04  1.294e-03   0.340 0.733876    
## unit_idGeorgetown hd                   -4.568e-03  1.347e-03  -3.392 0.000775 ***
## unit_idGeorgetown near                  4.972e-04  1.311e-03   0.379 0.704668    
## unit_idGreater 14th St hd               9.162e-03  1.359e-03   6.743 6.53e-11 ***
## unit_idGreater 14th St near             4.952e-03  1.292e-03   3.833 0.000151 ***
## unit_idGreater U St hd                  2.953e-03  1.359e-03   2.173 0.030445 *  
## unit_idGreater U St near                7.533e-03  1.292e-03   5.830 1.27e-08 ***
## unit_idGWU / Old West End hd            8.595e-03  1.438e-03   5.977 5.66e-09 ***
## unit_idGWU / Old West End near         -4.461e-04  1.300e-03  -0.343 0.731755    
## unit_idKalorama Triangle hd             9.556e-03  1.351e-03   7.075 8.39e-12 ***
## unit_idKalorama Triangle near           2.748e-03  1.294e-03   2.124 0.034405 *  
## unit_idKingman Park hd                 -5.240e-03  1.438e-03  -3.644 0.000309 ***
## unit_idKingman Park near                9.040e-04  1.300e-03   0.695 0.487388    
## unit_idLafayette Square hd             -8.609e-03  1.396e-03  -6.168 1.93e-09 ***
## unit_idLafayette Square near           -1.246e-03  1.300e-03  -0.958 0.338485    
## unit_idLeDroit Park hd                  9.975e-04  1.396e-03   0.715 0.475242    
## unit_idLeDroit Park near                2.643e-03  1.300e-03   2.033 0.042842 *  
## unit_idLogan Circle hd                  8.425e-03  1.396e-03   6.037 4.06e-09 ***
## unit_idLogan Circle near                4.134e-03  1.300e-03   3.179 0.001610 ** 
## unit_idMassachusetts Ave hd            -5.967e-04  1.396e-03  -0.428 0.669220    
## unit_idMassachusetts Ave near           1.162e-03  1.300e-03   0.893 0.372244    
## unit_idMeridian Hill hd                 1.085e-02  1.438e-03   7.544 4.09e-13 ***
## unit_idMeridian Hill near               7.520e-03  1.300e-03   5.783 1.65e-08 ***
## unit_idMt. Pleasant hd                  4.958e-03  1.351e-03   3.671 0.000280 ***
## unit_idMt. Pleasant near                3.329e-03  1.294e-03   2.573 0.010508 *  
## unit_idMt. Vernon Square hd             7.220e-04  1.406e-03   0.513 0.607974    
## unit_idMt. Vernon Square near           2.947e-03  1.292e-03   2.281 0.023156 *  
## unit_idPennsylvania Ave NHS hd         -8.456e-03  1.359e-03  -6.224 1.41e-09 ***
## unit_idPennsylvania Ave NHS near       -6.297e-04  1.292e-03  -0.487 0.626308    
## unit_idShaw hd                          8.841e-03  1.359e-03   6.507 2.69e-10 ***
## unit_idShaw near                        4.177e-03  1.292e-03   3.233 0.001345 ** 
## unit_idSheridan-Kalorama hd            -4.708e-03  1.351e-03  -3.486 0.000554 ***
## unit_idSheridan-Kalorama near           1.971e-03  1.294e-03   1.523 0.128656    
## unit_idSixteenth St hd                  1.453e-02  1.396e-03  10.414  < 2e-16 ***
## unit_idSixteenth St near                4.866e-03  1.300e-03   3.742 0.000214 ***
## unit_idStrivers' Section hd             1.678e-02  1.398e-03  12.003  < 2e-16 ***
## unit_idStrivers' Section near           6.004e-03  1.294e-03   4.639 4.97e-06 ***
## unit_idTakoma Park hd                  -5.334e-03  1.398e-03  -3.815 0.000161 ***
## unit_idTakoma Park near                 7.353e-04  1.294e-03   0.568 0.570274    
## unit_idWashington Heights hd            9.631e-03  1.420e-03   6.784 5.08e-11 ***
## unit_idWashington Heights near          6.321e-03  1.294e-03   4.884 1.59e-06 ***
## unit_idWoodley Park hd                  4.367e-03  1.406e-03   3.106 0.002057 ** 
## unit_idWoodley Park near                       NA         NA      NA       NA    
## year1970                               -2.990e-03  4.917e-04  -6.082 3.15e-09 ***
## year1980                               -4.669e-03  5.089e-04  -9.175  < 2e-16 ***
## year1990                               -4.814e-03  5.498e-04  -8.755  < 2e-16 ***
## year2000                               -4.801e-03  6.013e-04  -7.983 2.14e-14 ***
## year2010                               -4.018e-03  6.270e-04  -6.408 4.84e-10 ***
## year2020                               -3.139e-03  6.640e-04  -4.727 3.32e-06 ***
## treatment_group:desig_yet              -1.352e-03  5.305e-04  -2.548 0.011263 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.002417 on 345 degrees of freedom
##   (19 observations deleted due to missingness)
## Multiple R-squared:  0.8913, Adjusted R-squared:  0.8696 
## F-statistic: 41.01 on 69 and 345 DF,  p-value: < 2.2e-16
## 
## [1] "__________"
## [1] "Coef. on treatment variable when we add area fixed effects:"
##      Estimate    Std. Error       t value      Pr(>|t|) 
## -0.0013517706  0.0005304912 -2.5481487509  0.0112625364 
## [1] "_______________________________________________________"
## [1] "D-in-D regression for the % of black residents, using population weights"
## 
## Call:
## lm(formula = main_formula, data = comp_df_subset, weights = wt)
## 
## Weighted Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.67965 -0.05115  0.00015  0.04991  0.88299 
## 
## Coefficients: (1 not defined because of singularities)
##                                          Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                             8.343e-03  1.396e-03   5.978 6.04e-09 ***
## treatment_group                         7.706e-03  1.728e-03   4.461 1.13e-05 ***
## desig_yet                               1.512e-03  5.464e-04   2.766 0.006001 ** 
## unit_idAnacostia near                  -5.008e-04  1.698e-03  -0.295 0.768277    
## unit_idBlagden Alley/Naylor Court hd    2.179e-03  3.049e-03   0.715 0.475350    
## unit_idBlagden Alley/Naylor Court near  3.552e-03  3.165e-03   1.122 0.262517    
## unit_idBloomingdale hd                  1.892e-03  1.344e-03   1.408 0.160052    
## unit_idBloomingdale near                7.423e-04  1.574e-03   0.472 0.637423    
## unit_idCapitol Hill hd                 -8.578e-04  1.104e-03  -0.777 0.437816    
## unit_idCapitol Hill near                2.430e-04  1.407e-03   0.173 0.863000    
## unit_idCleveland Park hd               -5.998e-03  1.367e-03  -4.388 1.56e-05 ***
## unit_idCleveland Park near             -1.002e-03  1.616e-03  -0.620 0.535831    
## unit_idDowntown hd                     -2.601e-03  2.514e-03  -1.035 0.301606    
## unit_idDowntown near                    1.008e-04  2.649e-03   0.038 0.969655    
## unit_idDupont Circle hd                 6.531e-03  1.169e-03   5.585 5.00e-08 ***
## unit_idDupont Circle near               3.293e-03  1.459e-03   2.256 0.024717 *  
## unit_idFinancial hd                    -6.505e-03  5.807e-03  -1.120 0.263447    
## unit_idFinancial near                  -2.342e-03  5.871e-03  -0.399 0.690239    
## unit_idFoggy Bottom hd                  1.726e-02  2.247e-03   7.683 1.92e-13 ***
## unit_idFoggy Bottom near                4.287e-04  2.406e-03   0.178 0.858703    
## unit_idFoxhall hd                      -2.216e-03  2.817e-03  -0.787 0.431991    
## unit_idFoxhall near                    -3.768e-04  2.935e-03  -0.128 0.897936    
## unit_idGeorgetown hd                   -5.265e-03  1.182e-03  -4.453 1.17e-05 ***
## unit_idGeorgetown near                 -6.310e-04  1.480e-03  -0.426 0.670185    
## unit_idGreater 14th St hd               9.207e-03  1.256e-03   7.332 1.86e-12 ***
## unit_idGreater 14th St near             3.880e-03  1.515e-03   2.561 0.010901 *  
## unit_idGreater U St hd                  2.356e-03  1.258e-03   1.873 0.061962 .  
## unit_idGreater U St near                6.600e-03  1.516e-03   4.352 1.81e-05 ***
## unit_idGWU / Old West End hd            1.121e-02  1.774e-03   6.321 8.74e-10 ***
## unit_idGWU / Old West End near         -7.161e-05  1.950e-03  -0.037 0.970726    
## unit_idKalorama Triangle hd             9.929e-03  1.431e-03   6.940 2.18e-11 ***
## unit_idKalorama Triangle near           9.075e-04  1.669e-03   0.544 0.586936    
## unit_idKingman Park hd                 -5.902e-03  1.649e-03  -3.578 0.000399 ***
## unit_idKingman Park near                8.736e-04  1.837e-03   0.476 0.634667    
## unit_idLafayette Square hd             -1.018e-02  1.495e-02  -0.681 0.496392    
## unit_idLafayette Square near           -1.596e-03  1.497e-02  -0.107 0.915152    
## unit_idLeDroit Park hd                  9.323e-04  2.065e-03   0.452 0.651876    
## unit_idLeDroit Park near                2.235e-03  2.246e-03   0.995 0.320309    
## unit_idLogan Circle hd                  8.049e-03  2.175e-03   3.701 0.000253 ***
## unit_idLogan Circle near                3.130e-03  2.346e-03   1.334 0.183019    
## unit_idMassachusetts Ave hd            -1.099e-03  1.665e-03  -0.660 0.509623    
## unit_idMassachusetts Ave near          -3.912e-05  1.883e-03  -0.021 0.983434    
## unit_idMeridian Hill hd                 1.030e-02  1.491e-03   6.904 2.73e-11 ***
## unit_idMeridian Hill near               7.913e-03  1.695e-03   4.668 4.48e-06 ***
## unit_idMt. Pleasant hd                  4.284e-03  1.216e-03   3.523 0.000489 ***
## unit_idMt. Pleasant near                2.236e-03  1.490e-03   1.500 0.134523    
## unit_idMt. Vernon Square hd             4.174e-04  1.992e-03   0.210 0.834178    
## unit_idMt. Vernon Square near           2.841e-03  2.164e-03   1.313 0.190124    
## unit_idPennsylvania Ave NHS hd         -9.260e-03  2.291e-03  -4.042 6.66e-05 ***
## unit_idPennsylvania Ave NHS near       -2.029e-03  2.448e-03  -0.829 0.407668    
## unit_idShaw hd                          9.234e-03  1.347e-03   6.856 3.65e-11 ***
## unit_idShaw near                        3.318e-03  1.592e-03   2.084 0.037938 *  
## unit_idSheridan-Kalorama hd            -5.783e-03  1.589e-03  -3.640 0.000317 ***
## unit_idSheridan-Kalorama near           1.071e-03  1.806e-03   0.593 0.553839    
## unit_idSixteenth St hd                  1.400e-02  1.376e-03  10.175  < 2e-16 ***
## unit_idSixteenth St near                3.459e-03  1.633e-03   2.118 0.034949 *  
## unit_idStrivers' Section hd             1.636e-02  1.605e-03  10.190  < 2e-16 ***
## unit_idStrivers' Section near           4.629e-03  1.821e-03   2.542 0.011506 *  
## unit_idTakoma Park hd                  -5.820e-03  2.078e-03  -2.801 0.005404 ** 
## unit_idTakoma Park near                 3.356e-04  2.250e-03   0.149 0.881491    
## unit_idWashington Heights hd            9.104e-03  1.591e-03   5.723 2.40e-08 ***
## unit_idWashington Heights near          5.135e-03  1.793e-03   2.864 0.004458 ** 
## unit_idWoodley Park hd                  3.786e-03  1.698e-03   2.229 0.026497 *  
## unit_idWoodley Park near                       NA         NA      NA       NA    
## year1970                               -4.536e-03  4.503e-04 -10.074  < 2e-16 ***
## year1980                               -6.566e-03  5.284e-04 -12.426  < 2e-16 ***
## year1990                               -6.712e-03  5.821e-04 -11.531  < 2e-16 ***
## year2000                               -6.649e-03  6.320e-04 -10.520  < 2e-16 ***
## year2010                               -6.203e-03  6.355e-04  -9.761  < 2e-16 ***
## year2020                               -5.109e-03  6.716e-04  -7.607 3.16e-13 ***
## treatment_group:desig_yet              -2.439e-03  5.294e-04  -4.607 5.92e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.1707 on 320 degrees of freedom
##   (38 observations deleted due to missingness)
## Multiple R-squared:  0.8932, Adjusted R-squared:  0.8701 
## F-statistic: 38.77 on 69 and 320 DF,  p-value: < 2.2e-16
## 
## [1] "__________"
## [1] "Coef. on treatment variable when we add area fixed effects:"
##      Estimate    Std. Error       t value      Pr(>|t|) 
## -2.438513e-03  5.293572e-04 -4.606555e+00  5.918192e-06 
## [1] "_______________________________________________________"
## [1] "D-in-D regression for the % of white residents, unweighted"
## 
## Call:
## lm(formula = main_formula, data = comp_df_subset, weights = wt)
## 
## Residuals:
##        Min         1Q     Median         3Q        Max 
## -0.0090133 -0.0009280  0.0000887  0.0008235  0.0118304 
## 
## Coefficients: (1 not defined because of singularities)
##                                          Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                             6.163e-03  9.777e-04   6.304 8.88e-10 ***
## treatment_group                         7.149e-03  1.397e-03   5.118 5.15e-07 ***
## desig_yet                               8.041e-04  5.131e-04   1.567 0.118019    
## unit_idAnacostia near                  -6.439e-05  1.300e-03  -0.050 0.960534    
## unit_idBlagden Alley/Naylor Court hd    1.974e-03  1.406e-03   1.404 0.161239    
## unit_idBlagden Alley/Naylor Court near  3.910e-03  1.292e-03   3.026 0.002663 ** 
## unit_idBloomingdale hd                  2.740e-03  1.386e-03   1.976 0.048903 *  
## unit_idBloomingdale near                1.839e-03  1.300e-03   1.414 0.158227    
## unit_idCapitol Hill hd                 -1.192e-04  1.347e-03  -0.088 0.929548    
## unit_idCapitol Hill near                1.480e-03  1.300e-03   1.138 0.255995    
## unit_idCleveland Park hd               -5.156e-03  1.351e-03  -3.817 0.000160 ***
## unit_idCleveland Park near              1.447e-05  1.294e-03   0.011 0.991083    
## unit_idDowntown hd                     -3.609e-03  1.420e-03  -2.542 0.011445 *  
## unit_idDowntown near                   -1.906e-04  1.294e-03  -0.147 0.883021    
## unit_idDupont Circle hd                 6.758e-03  1.347e-03   5.018 8.38e-07 ***
## unit_idDupont Circle near               4.083e-03  1.300e-03   3.140 0.001837 ** 
## unit_idFinancial hd                    -7.821e-03  1.398e-03  -5.594 4.53e-08 ***
## unit_idFinancial near                  -1.447e-03  1.294e-03  -1.118 0.264223    
## unit_idFoggy Bottom hd                  1.677e-02  1.398e-03  11.994  < 2e-16 ***
## unit_idFoggy Bottom near                1.295e-03  1.294e-03   1.000 0.317794    
## unit_idFoxhall hd                      -1.517e-03  1.420e-03  -1.069 0.285959    
## unit_idFoxhall near                     4.403e-04  1.294e-03   0.340 0.733876    
## unit_idGeorgetown hd                   -4.568e-03  1.347e-03  -3.392 0.000775 ***
## unit_idGeorgetown near                  4.972e-04  1.311e-03   0.379 0.704668    
## unit_idGreater 14th St hd               9.162e-03  1.359e-03   6.743 6.53e-11 ***
## unit_idGreater 14th St near             4.952e-03  1.292e-03   3.833 0.000151 ***
## unit_idGreater U St hd                  2.953e-03  1.359e-03   2.173 0.030445 *  
## unit_idGreater U St near                7.533e-03  1.292e-03   5.830 1.27e-08 ***
## unit_idGWU / Old West End hd            8.595e-03  1.438e-03   5.977 5.66e-09 ***
## unit_idGWU / Old West End near         -4.461e-04  1.300e-03  -0.343 0.731755    
## unit_idKalorama Triangle hd             9.556e-03  1.351e-03   7.075 8.39e-12 ***
## unit_idKalorama Triangle near           2.748e-03  1.294e-03   2.124 0.034405 *  
## unit_idKingman Park hd                 -5.240e-03  1.438e-03  -3.644 0.000309 ***
## unit_idKingman Park near                9.040e-04  1.300e-03   0.695 0.487388    
## unit_idLafayette Square hd             -8.609e-03  1.396e-03  -6.168 1.93e-09 ***
## unit_idLafayette Square near           -1.246e-03  1.300e-03  -0.958 0.338485    
## unit_idLeDroit Park hd                  9.975e-04  1.396e-03   0.715 0.475242    
## unit_idLeDroit Park near                2.643e-03  1.300e-03   2.033 0.042842 *  
## unit_idLogan Circle hd                  8.425e-03  1.396e-03   6.037 4.06e-09 ***
## unit_idLogan Circle near                4.134e-03  1.300e-03   3.179 0.001610 ** 
## unit_idMassachusetts Ave hd            -5.967e-04  1.396e-03  -0.428 0.669220    
## unit_idMassachusetts Ave near           1.162e-03  1.300e-03   0.893 0.372244    
## unit_idMeridian Hill hd                 1.085e-02  1.438e-03   7.544 4.09e-13 ***
## unit_idMeridian Hill near               7.520e-03  1.300e-03   5.783 1.65e-08 ***
## unit_idMt. Pleasant hd                  4.958e-03  1.351e-03   3.671 0.000280 ***
## unit_idMt. Pleasant near                3.329e-03  1.294e-03   2.573 0.010508 *  
## unit_idMt. Vernon Square hd             7.220e-04  1.406e-03   0.513 0.607974    
## unit_idMt. Vernon Square near           2.947e-03  1.292e-03   2.281 0.023156 *  
## unit_idPennsylvania Ave NHS hd         -8.456e-03  1.359e-03  -6.224 1.41e-09 ***
## unit_idPennsylvania Ave NHS near       -6.297e-04  1.292e-03  -0.487 0.626308    
## unit_idShaw hd                          8.841e-03  1.359e-03   6.507 2.69e-10 ***
## unit_idShaw near                        4.177e-03  1.292e-03   3.233 0.001345 ** 
## unit_idSheridan-Kalorama hd            -4.708e-03  1.351e-03  -3.486 0.000554 ***
## unit_idSheridan-Kalorama near           1.971e-03  1.294e-03   1.523 0.128656    
## unit_idSixteenth St hd                  1.453e-02  1.396e-03  10.414  < 2e-16 ***
## unit_idSixteenth St near                4.866e-03  1.300e-03   3.742 0.000214 ***
## unit_idStrivers' Section hd             1.678e-02  1.398e-03  12.003  < 2e-16 ***
## unit_idStrivers' Section near           6.004e-03  1.294e-03   4.639 4.97e-06 ***
## unit_idTakoma Park hd                  -5.334e-03  1.398e-03  -3.815 0.000161 ***
## unit_idTakoma Park near                 7.353e-04  1.294e-03   0.568 0.570274    
## unit_idWashington Heights hd            9.631e-03  1.420e-03   6.784 5.08e-11 ***
## unit_idWashington Heights near          6.321e-03  1.294e-03   4.884 1.59e-06 ***
## unit_idWoodley Park hd                  4.367e-03  1.406e-03   3.106 0.002057 ** 
## unit_idWoodley Park near                       NA         NA      NA       NA    
## year1970                               -2.990e-03  4.917e-04  -6.082 3.15e-09 ***
## year1980                               -4.669e-03  5.089e-04  -9.175  < 2e-16 ***
## year1990                               -4.814e-03  5.498e-04  -8.755  < 2e-16 ***
## year2000                               -4.801e-03  6.013e-04  -7.983 2.14e-14 ***
## year2010                               -4.018e-03  6.270e-04  -6.408 4.84e-10 ***
## year2020                               -3.139e-03  6.640e-04  -4.727 3.32e-06 ***
## treatment_group:desig_yet              -1.352e-03  5.305e-04  -2.548 0.011263 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.002417 on 345 degrees of freedom
##   (19 observations deleted due to missingness)
## Multiple R-squared:  0.8913, Adjusted R-squared:  0.8696 
## F-statistic: 41.01 on 69 and 345 DF,  p-value: < 2.2e-16
## 
## [1] "__________"
## [1] "Coef. on treatment variable when we add area fixed effects:"
##      Estimate    Std. Error       t value      Pr(>|t|) 
## -0.0013517706  0.0005304912 -2.5481487509  0.0112625364 
## [1] "_______________________________________________________"
## [1] "D-in-D regression for the % of white residents, using population weights"
## 
## Call:
## lm(formula = main_formula, data = comp_df_subset, weights = wt)
## 
## Weighted Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.67965 -0.05115  0.00015  0.04991  0.88299 
## 
## Coefficients: (1 not defined because of singularities)
##                                          Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                             8.343e-03  1.396e-03   5.978 6.04e-09 ***
## treatment_group                         7.706e-03  1.728e-03   4.461 1.13e-05 ***
## desig_yet                               1.512e-03  5.464e-04   2.766 0.006001 ** 
## unit_idAnacostia near                  -5.008e-04  1.698e-03  -0.295 0.768277    
## unit_idBlagden Alley/Naylor Court hd    2.179e-03  3.049e-03   0.715 0.475350    
## unit_idBlagden Alley/Naylor Court near  3.552e-03  3.165e-03   1.122 0.262517    
## unit_idBloomingdale hd                  1.892e-03  1.344e-03   1.408 0.160052    
## unit_idBloomingdale near                7.423e-04  1.574e-03   0.472 0.637423    
## unit_idCapitol Hill hd                 -8.578e-04  1.104e-03  -0.777 0.437816    
## unit_idCapitol Hill near                2.430e-04  1.407e-03   0.173 0.863000    
## unit_idCleveland Park hd               -5.998e-03  1.367e-03  -4.388 1.56e-05 ***
## unit_idCleveland Park near             -1.002e-03  1.616e-03  -0.620 0.535831    
## unit_idDowntown hd                     -2.601e-03  2.514e-03  -1.035 0.301606    
## unit_idDowntown near                    1.008e-04  2.649e-03   0.038 0.969655    
## unit_idDupont Circle hd                 6.531e-03  1.169e-03   5.585 5.00e-08 ***
## unit_idDupont Circle near               3.293e-03  1.459e-03   2.256 0.024717 *  
## unit_idFinancial hd                    -6.505e-03  5.807e-03  -1.120 0.263447    
## unit_idFinancial near                  -2.342e-03  5.871e-03  -0.399 0.690239    
## unit_idFoggy Bottom hd                  1.726e-02  2.247e-03   7.683 1.92e-13 ***
## unit_idFoggy Bottom near                4.287e-04  2.406e-03   0.178 0.858703    
## unit_idFoxhall hd                      -2.216e-03  2.817e-03  -0.787 0.431991    
## unit_idFoxhall near                    -3.768e-04  2.935e-03  -0.128 0.897936    
## unit_idGeorgetown hd                   -5.265e-03  1.182e-03  -4.453 1.17e-05 ***
## unit_idGeorgetown near                 -6.310e-04  1.480e-03  -0.426 0.670185    
## unit_idGreater 14th St hd               9.207e-03  1.256e-03   7.332 1.86e-12 ***
## unit_idGreater 14th St near             3.880e-03  1.515e-03   2.561 0.010901 *  
## unit_idGreater U St hd                  2.356e-03  1.258e-03   1.873 0.061962 .  
## unit_idGreater U St near                6.600e-03  1.516e-03   4.352 1.81e-05 ***
## unit_idGWU / Old West End hd            1.121e-02  1.774e-03   6.321 8.74e-10 ***
## unit_idGWU / Old West End near         -7.161e-05  1.950e-03  -0.037 0.970726    
## unit_idKalorama Triangle hd             9.929e-03  1.431e-03   6.940 2.18e-11 ***
## unit_idKalorama Triangle near           9.075e-04  1.669e-03   0.544 0.586936    
## unit_idKingman Park hd                 -5.902e-03  1.649e-03  -3.578 0.000399 ***
## unit_idKingman Park near                8.736e-04  1.837e-03   0.476 0.634667    
## unit_idLafayette Square hd             -1.018e-02  1.495e-02  -0.681 0.496392    
## unit_idLafayette Square near           -1.596e-03  1.497e-02  -0.107 0.915152    
## unit_idLeDroit Park hd                  9.323e-04  2.065e-03   0.452 0.651876    
## unit_idLeDroit Park near                2.235e-03  2.246e-03   0.995 0.320309    
## unit_idLogan Circle hd                  8.049e-03  2.175e-03   3.701 0.000253 ***
## unit_idLogan Circle near                3.130e-03  2.346e-03   1.334 0.183019    
## unit_idMassachusetts Ave hd            -1.099e-03  1.665e-03  -0.660 0.509623    
## unit_idMassachusetts Ave near          -3.912e-05  1.883e-03  -0.021 0.983434    
## unit_idMeridian Hill hd                 1.030e-02  1.491e-03   6.904 2.73e-11 ***
## unit_idMeridian Hill near               7.913e-03  1.695e-03   4.668 4.48e-06 ***
## unit_idMt. Pleasant hd                  4.284e-03  1.216e-03   3.523 0.000489 ***
## unit_idMt. Pleasant near                2.236e-03  1.490e-03   1.500 0.134523    
## unit_idMt. Vernon Square hd             4.174e-04  1.992e-03   0.210 0.834178    
## unit_idMt. Vernon Square near           2.841e-03  2.164e-03   1.313 0.190124    
## unit_idPennsylvania Ave NHS hd         -9.260e-03  2.291e-03  -4.042 6.66e-05 ***
## unit_idPennsylvania Ave NHS near       -2.029e-03  2.448e-03  -0.829 0.407668    
## unit_idShaw hd                          9.234e-03  1.347e-03   6.856 3.65e-11 ***
## unit_idShaw near                        3.318e-03  1.592e-03   2.084 0.037938 *  
## unit_idSheridan-Kalorama hd            -5.783e-03  1.589e-03  -3.640 0.000317 ***
## unit_idSheridan-Kalorama near           1.071e-03  1.806e-03   0.593 0.553839    
## unit_idSixteenth St hd                  1.400e-02  1.376e-03  10.175  < 2e-16 ***
## unit_idSixteenth St near                3.459e-03  1.633e-03   2.118 0.034949 *  
## unit_idStrivers' Section hd             1.636e-02  1.605e-03  10.190  < 2e-16 ***
## unit_idStrivers' Section near           4.629e-03  1.821e-03   2.542 0.011506 *  
## unit_idTakoma Park hd                  -5.820e-03  2.078e-03  -2.801 0.005404 ** 
## unit_idTakoma Park near                 3.356e-04  2.250e-03   0.149 0.881491    
## unit_idWashington Heights hd            9.104e-03  1.591e-03   5.723 2.40e-08 ***
## unit_idWashington Heights near          5.135e-03  1.793e-03   2.864 0.004458 ** 
## unit_idWoodley Park hd                  3.786e-03  1.698e-03   2.229 0.026497 *  
## unit_idWoodley Park near                       NA         NA      NA       NA    
## year1970                               -4.536e-03  4.503e-04 -10.074  < 2e-16 ***
## year1980                               -6.566e-03  5.284e-04 -12.426  < 2e-16 ***
## year1990                               -6.712e-03  5.821e-04 -11.531  < 2e-16 ***
## year2000                               -6.649e-03  6.320e-04 -10.520  < 2e-16 ***
## year2010                               -6.203e-03  6.355e-04  -9.761  < 2e-16 ***
## year2020                               -5.109e-03  6.716e-04  -7.607 3.16e-13 ***
## treatment_group:desig_yet              -2.439e-03  5.294e-04  -4.607 5.92e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.1707 on 320 degrees of freedom
##   (38 observations deleted due to missingness)
## Multiple R-squared:  0.8932, Adjusted R-squared:  0.8701 
## F-statistic: 38.77 on 69 and 320 DF,  p-value: < 2.2e-16
## 
## [1] "__________"
## [1] "Coef. on treatment variable when we add area fixed effects:"
##      Estimate    Std. Error       t value      Pr(>|t|) 
## -2.438513e-03  5.293572e-04 -4.606555e+00  5.918192e-06
## 
## Call:
## did::att_gt(yname = dep_var, tname = "year", idname = "unit_id_num", 
##     gname = "first_decade_desig", xformla = ~1, data = comp_df[comp_df$group == 
##         "black" & !is.na(comp_df$n_tot_hd), ], allow_unbalanced_panel = T, 
##     weightsname = "n_tot_hd")
## 
## Reference: Callaway, Brantly and Pedro H.C. Sant'Anna.  "Difference-in-Differences with Multiple Time Periods." Journal of Econometrics, Vol. 225, No. 2, pp. 200-230, 2021. <https://doi.org/10.1016/j.jeconom.2020.12.001>, <https://arxiv.org/abs/1803.09015> 
## 
## Group-Time Average Treatment Effects:
##  Group Time ATT(g,t) Std. Error [95% Simult.  Conf. Band]  
##   1970 1970   0.0023     0.0012       -0.0005      0.0051  
##   1970 1980   0.0035     0.0014        0.0003      0.0066 *
##   1970 1990   0.0038     0.0012        0.0010      0.0067 *
##   1970 2000   0.0041     0.0011        0.0015      0.0067 *
##   1970 2010   0.0040     0.0011        0.0014      0.0066 *
##   1970 2020   0.0025     0.0011       -0.0001      0.0052  
##   1980 1970  -0.0042     0.0033       -0.0117      0.0034  
##   1980 1980  -0.0012     0.0005       -0.0024     -0.0001 *
##   1980 1990  -0.0016     0.0008       -0.0033      0.0002  
##   1980 2000  -0.0017     0.0006       -0.0030     -0.0004 *
##   1980 2010  -0.0023     0.0004       -0.0032     -0.0014 *
##   1980 2020  -0.0027     0.0006       -0.0041     -0.0012 *
##   1990 1970  -0.0013     0.0055       -0.0139      0.0113  
##   1990 1980   0.0003     0.0017       -0.0037      0.0043  
##   1990 1990  -0.0004     0.0011       -0.0030      0.0023  
##   1990 2000  -0.0001     0.0016       -0.0037      0.0036  
##   1990 2010  -0.0022     0.0008       -0.0040     -0.0003 *
##   1990 2020  -0.0035     0.0009       -0.0056     -0.0014 *
##   2000 1970  -0.0075     0.0037       -0.0161      0.0010  
##   2000 1980  -0.0037     0.0006       -0.0052     -0.0023 *
##   2000 1990   0.0003     0.0005       -0.0009      0.0014  
##   2000 2000   0.0006     0.0009       -0.0014      0.0026  
##   2000 2010   0.0014     0.0014       -0.0019      0.0047  
##   2000 2020   0.0025     0.0015       -0.0010      0.0059  
##   2010 1970       NA         NA            NA          NA  
##   2010 1980  -0.0046     0.0009       -0.0067     -0.0024 *
##   2010 1990   0.0003     0.0007       -0.0014      0.0020  
##   2010 2000  -0.0012     0.0004       -0.0021     -0.0004 *
##   2010 2010   0.0001     0.0002       -0.0003      0.0005  
##   2010 2020   0.0007     0.0007       -0.0010      0.0025  
##   2020 1970  -0.0013     0.0047       -0.0121      0.0095  
##   2020 1980  -0.0005     0.0034       -0.0084      0.0075  
##   2020 1990  -0.0017     0.0020       -0.0063      0.0029  
##   2020 2000  -0.0009     0.0004       -0.0018      0.0000 *
##   2020 2010   0.0047     0.0037       -0.0038      0.0132  
##   2020 2020  -0.0006     0.0010       -0.0029      0.0016  
## ---
## Signif. codes: `*' confidence band does not cover 0
## 
## P-value for pre-test of parallel trends assumption:  0
## Control Group:  Never Treated,  Anticipation Periods:  0
## Estimation Method:  Doubly Robust
## NULL
## 
## Call:
## aggte(MP = hd.attgt, type = "group", na.rm = T)
## 
## Reference: Callaway, Brantly and Pedro H.C. Sant'Anna.  "Difference-in-Differences with Multiple Time Periods." Journal of Econometrics, Vol. 225, No. 2, pp. 200-230, 2021. <https://doi.org/10.1016/j.jeconom.2020.12.001>, <https://arxiv.org/abs/1803.09015> 
## 
## 
## Overall summary of ATT's based on group/cohort aggregation:  
##     ATT    Std. Error     [ 95%  Conf. Int.] 
##  -5e-04         5e-04    -0.0016       6e-04 
## 
## 
## Group Effects:
##  Group Estimate Std. Error [95% Simult.  Conf. Band]  
##   1970   0.0034     0.0012        0.0010      0.0057 *
##   1980  -0.0019     0.0005       -0.0029     -0.0009 *
##   1990  -0.0015     0.0008       -0.0032      0.0002  
##   2000   0.0015     0.0010       -0.0006      0.0036  
##   2010   0.0004     0.0004       -0.0003      0.0011  
##   2020  -0.0006     0.0011       -0.0029      0.0016  
## ---
## Signif. codes: `*' confidence band does not cover 0
## 
## Control Group:  Never Treated,  Anticipation Periods:  0
## Estimation Method:  Doubly Robust
## NULL
rv$lineplots$pop_dens